Esempio n. 1
0
int main(int argc, char *argv[])
{
   int i;				/* Loop variable */
   XYZ xyz;				/* Coordinate for plotting points */
   COLOUR col;				/* Colour of plotted points */

   s2opend("/S2MONO",argc,argv);	/* Query the s2plot device to use */
   s2swin(-1.,1.,-1.,1.,-1.,1.);	/* Set the world coordinates */
   s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);	/* Draw a coordinate box */

   srand48((long)time(NULL));		/* Seed the random number generator */

   for (i=0;i<1000;i++) {		/* Generate and plot random points */
      xyz.x = drand48()*2.0 - 1.0;	/*  with random colours */
      xyz.y = drand48()*2.0 - 1.0;
      xyz.z = drand48()*2.0 - 1.0;
      col.r = drand48();
      col.g = drand48();
      col.b = drand48();
      ns2vpoint(xyz, col);
   }
   ss2sas(1);				/* Start the geometry auto-spinning */
   cs2scb(cb);				/* Install a dynamic callback */
   s2show(1);				/* Display the geometry */
   return 0;
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
   XYZ xyz;					/* Declare an XYZ variable */
   COLOUR col;					/* Declare a COLOUR variable */
   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   xyz.x =  0.0;				/* Set some values */
   xyz.y =  0.5;
   xyz.z = -0.3;

   col.r = 0.3;					/* Set colour value */
   col.g = 1.0;
   col.b = 0.7;

   ns2vpoint(xyz, col);				/* Draw the point */

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}