void showsettings() { char str[256]; int xpos; ortho2(-0.5,xsize-0.5,-0.5,ysize-0.5); color(51); rectfi(0,0,xsize,2*SLIDERHIGH); color(0); sprintf(str,"Mass %g",curmass); cmov2i(20,3+1*SLIDERHIGH); charstr(str); sprintf(str,"Drag %g",curdrag); cmov2i(20,3+0*SLIDERHIGH); charstr(str); move2i(SLIDERLEFT,0); draw2i(SLIDERLEFT,2*SLIDERHIGH); move2i(0,1*SLIDERHIGH); draw2i(xsize,1*SLIDERHIGH); move2i(0,2*SLIDERHIGH); draw2i(xsize,2*SLIDERHIGH); color(1); xpos = SLIDERLEFT+curmass*(xsize-SLIDERLEFT); rectfi(xpos,1*SLIDERHIGH,xpos+4,2*SLIDERHIGH); xpos = SLIDERLEFT+curdrag*(xsize-SLIDERLEFT); rectfi(xpos,0*SLIDERHIGH,xpos+4,1*SLIDERHIGH); ortho2(0.0,1.25,0.0,1.0); }
/* plot_mat: creates a simple colour-coded dot representation of Mat, * which is assumed to be a Row x Col matrix. The colours vary from * blue for Lowval values to red for Upval values. Values lower than * Lowval will be black, higher than Upval will be white. * Plotting is performed in window no. Gid. * Call winclose() to dispose of this window. */ void plot_mat(long Gid, double **Mat, unsigned int Row, unsigned int Col, double Lowval, double Upval) { register unsigned int i,j; winset(Gid); /* make this the current window */ reshapeviewport(); cpack(RGB_BLACK); clear(); for (i=0; i<Row; i++) /* scans Mat */ for (j=0; j<Col; j++) { /* select code color for Mt values */ cpack(rainbow_ramp(Mat[i][j], Lowval, Upval)); /* plot the point */ rectfi(j, Row-i, j+1, Row-i-1); } /* flush graphics */ if (Dblbuffer) swapbuffers(); else gflush(); }