/* stringart.c 1.3 84/04/22 */ #include #define NUMLINES 343 /* number of vectors in a design */ #define NUM_FUNCTIONS 13 /* number of functions */ /* This demo creates random vector designs. This is accomplished by randomly choosing a function for each coordinate halve of the two points describing a vector that moves through two dimensional space. Both x coordinate halves cannot be the same since the design would simply be a collection of vertical lines. Similarly both y coordinate halves cannot be the same. The functions are: */ /* The values of the functions were pre computed to have the demo run as fast as possible. The program will only terminate on interrupt since it is in an endless loop. */ extern double cos(), sin(); int func[13][NUMLINES]; int contrl[12], intin[256], ptsin[256], intout[256], ptsout[256]; int dummy,handle; int xwidth,ywidth,height,width; int pxy[4],t1,t2,t3,t4; int i,j,k,l,m; int mx; long Randx=1; main() { /* Set the system up to do GEM calls */ appl_init(); /* Get the handle of the desktop */ handle=graf_handle(&height,&width,&dummy,&dummy); /* Open the workstation. */ for(i=1; i<10; ++i) intin[i] = 1; intin[10] = 2; v_opnvwk(intin, &handle, intout); pxy[0]=0; pxy[1]=0;pxy[2]=intout[0];pxy[3]=intout[1]; xwidth=pxy[2]; ywidth= pxy[3]; graf_mouse(0,i); v_clrwk(handle); v_gtext(handle,0,height,"Precomputing coefficients ... please wait"); init(); Srand((long) Gettime()); while(!Bconstat(2)){ v_clrwk(handle); i=Rand()%NUM_FUNCTIONS; while((j = Rand()%NUM_FUNCTIONS)==i); k=Rand()%NUM_FUNCTIONS; while((l = Rand()%NUM_FUNCTIONS)==k); /* only do NUMLINES-1 lines ... dont redraw first line */ for(m=0;m