コード例 #1
0
int main(int argc, char *argv[])
{
   XYZ xyz = { 0.0, 0.0, 0.0 };			/* Position */
   XYZ right = { 0.05, 0.0, 0.0 };		/* Right vector */
   XYZ up = { 0.0, 0.05, 0.0 };			/* Up vector */
   COLOUR col = { 1.0, 1.0, 0.0 };		/* Colour */
   char text[32];				/* Text */
   float sp = 5.0;				/* Speed */

   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 */

   sp = ss2qss();				/* Get spin speed */
   sprintf(text,"Speed = %5.2f",sp);		/* Prepare the text */
   ns2vtext(xyz, right, up, col, text);		/* Right some text */
  
   s2lab("","","","Use * and / to control the spin speed");

   ss2sas(1);					/* Start camera rotating */

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}
コード例 #2
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;
}