/* plot3d.c */ #include "tdp.h" void plot3d() { register short i; short pdir, ystart, yinc, xstart, xinc; short pass, color, color_start, color_inc; short nhpts, nvpts, hinc, vinc; int *xthis, *ythis, *xlast, *ylast; short i_phi, i_theta, ycross; calc(); /*** SET PLOTTING ORDER, DIRECTION SO THAT HIDDEN LINE ALGORITHM WORKS ***/ i_phi = (int)(phi/d2r); if (debug) printf("i_phi=%d\n",i_phi); /* assume, for the moment, that abs(theta) <= 90 degrees */ if (i_phi < -135) {xstart=0; ystart=nypts-1; pdir=-1; ycross=TRUE;} else if (i_phi < -90) {xstart=0; ystart=nypts-1; pdir=1; ycross=FALSE;} else if (i_phi < -45) {xstart=0; ystart=0; pdir=-1; ycross=FALSE;} else if (i_phi < 0) {xstart=0; ystart=0; pdir=1; ycross=TRUE;} else if (i_phi < 45) {xstart=nxpts-1; ystart=0; pdir=-1; ycross=TRUE;} else if (i_phi < 90) {xstart=nxpts-1; ystart=0; pdir=1; ycross=FALSE;} else if (i_phi < 135) {xstart=nxpts-1; ystart=nypts-1; pdir=-1; ycross=FALSE;} else {xstart=nxpts-1; ystart=nypts-1; pdir=1; ycross=TRUE;} color_start = 0; /* handle abs(theta) > 90 degrees */ i_theta = (int)(theta/d2r); if (debug) printf("i_theta=%d\n",i_theta); if (abs(i_theta) > 90) { color_start = nsides-1; ystart = ((ystart) ? 0 : nypts-1); xstart = ((xstart) ? 0 : nxpts-1); pdir = -pdir; } color_inc = ((color_start) ? -1 : 1); xinc = ((xstart) ? -1 : 1); yinc = ((ystart) ? -1 : 1); xthis = &x[ystart][xstart]; ythis = &y[ystart][xstart]; if (ycross) {nhpts=nxpts; nvpts=nypts; hinc=xinc; vinc=yinc*MAXCHAN;} else {nhpts=nypts; nvpts=nxpts; hinc=yinc*MAXCHAN; vinc=xinc;} /*** PLOT ***/ for (i = 0; i < MAXHORIZ; i++) {vhicum[i] = 0; vlocum[i] = 400;} if (debug) {printf("hit return for plot\n"); while (!gets(str));} initwind(); if (PlotFile) { fprintf(pfp,"IN; SC 0 %d 0 %d;\n",MAXHORIZ+2,MAXVERT+2); /* fprintf(pfp,"VS 30.0;\n"); */ /* VELOCITY cm/s */ fprintf(pfp,"\033.N;19:\033.I81;;17:\n"); /* xON/xOFF handshake */ fprintf(pfp,"SP;\n"); } if (inverse_vid) {SetRGB4(vp,BACKGND_COLOR,0,0,0); SetRGB4(vp,PASS_0_COLOR,15,15,15);} for (pass=0, color=color_start; pass