Esempio n. 1
0
int main(int argc, char *argv[])
{
   int i, N = 20;
   float x[20], y[20], z[20];			/* Static geometry */

   srand48((long)time(NULL));			/* Seed random numbers */
   for (i=0;i<N;i++) {
      x[i] = drand48()*4.0-2.0;			/* Random positions */
      y[i] = drand48()*4.0-2.0;
      z[i] = drand48()*4.0-2.0;
   }
  
   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-2.,2., -2.,2., -2.,2.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   cs2scb(&cb);                                  /* Install the callback */
   cs2sncb(&ncb);                              /* Install number callback */
 
   s2slw(4);					/* Set line width */
   s2sci(S2_PG_YELLOW);
   s2pt(N,x,y,z,1);				/* Draw static data */
   s2slw(1);

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}
Esempio n. 2
0
int main(int argc, char *argv[])
{

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

   cs2scb(&cb);					/* Install callback */
   cs2sncb(&numcb);				/* Install number callback */

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
   srand48((long)time(NULL));			/* Seed random numbers */
   s2opend("/?", argc, argv);			/* Prompt for display type */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   cs2scb(cb);					/* Install dynamic geometry callback */
   cs2sncb(ncb);				/* Install number key press callback */

   char string[128];				/* Write instruction label */
   sprintf(string,"Press 1 to protect, press 2 to unprotect");
   s2lab("","","",string);

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
   int i, N = 20;				/* Loop variables */
   float x, y, z;				/* Random data */
   XYZ focus;					/* Point to rotate about */
   int wc = 1;					/* Use world coordinates */

   srand48((long)time(NULL));			/* Seed random numbers */

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

   s2slw(3);					/* Set line width */
   for (i=0;i<N;i++) {
      x = drand48()*2.0 - 1.0;			/* Random (x,y,z) */
      y = drand48()*2.0 - 1.0;
      z = drand48()*2.0 - 1.0;
      s2sci(15*drand48() + 1);			/* Random colour */
      s2pt1(x,y,z,1);				/* Plot the point */
   }

   focus.x = drand48()*2.0 - 1.0;		/* Random rotation point */
   focus.y = drand48()*2.0 - 1.0;
   focus.z = drand48()*2.0 - 1.0;
   ss2scf(focus, wc);				/* Set the rotation point */

   s2sch(0.7);					/* Set text height */
   s2textxy(-1,0,0,"Rotate camera - then press 1 followed by +"); 

   cs2sncb(&numcb);				/* Install number callback */

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