#include "main.h" #include "torus.h" #include #include #include #include double cos(double x); double sin(double x); #define EPSILON 1e-8 #define NBCERCLES 36 #define NBPOINTS 36 #define RAYON 100 int NbAff = 0; double *px,*py,*pz; void alarme (int sig) { printf("NbAff = %d\n",NbAff); NbAff = 0; alarm (10); } int main (int argc,char *argv[]) { if (argc > 1) { printf("%s\n",argv[0]); printf("%s\n",argv[1]); if (strcmp(argv[1],"BVM") == 0) { printf("BVM only\n"); BVM_ONLY = 1; } } /* Init X11 for 24 bpp */ init_x (); /* Set up the alarm */ signal (SIGALRM,alarme); alarm (10); while (event_x()) { refresh (); aff (); } for(;;); /* Free */ free (px); free (py); free (pz); /* Close X */ close_x(); /* End */ exit (0); } void aff () { NbAff ++; XPutImage(dis,win,gc,xim,0,0,0,0,W,H); } void refresh () { int i,j; long int V,R ; double d; static int t=1; double zoom = 0.20 + 0.01*t; double theta = 0.15 + 0.05*t; Intersect Inter ; memset ( buffer , 0 , 4*W*H ); for (j=0;j 255) { V = 255 ; } if (V < 0) V = 0 ; buffer[4*(i*H+j)+0] = V; buffer[4*(i*H+j)+1] = V; buffer[4*(i*H+j)+2] = V+R; } t ++; }