/* gcc surfaceplotter.c -L/usr/X11R6/lib -lplot -lXaw -lXmu -lXt -lSM */ /* -lICE -lXext -lX11 -lm */ #include #include #include #include #include #define N 31 /* should be odd */ /* creates a N X N grid, with middle being x-y axes */ /* rotates figure by two Euler angles for different */ /* camera angles */ #define PI 3.1415927 double Z[N*N],X[N*N],Y[N*N]; double theta,phi,tmpx,tmpy,tmpz,dx,dy,dt,x,y,dimensionx, dimensiony,t; double axes[4][2]; double function(double x, double y, double t); int mod(int A, int B); int n,m,time,Tmax; int pl_handle; FILE *fptr; main (int argc, char *argv[]) { dx = 0.2; dy = 0.2; dt = 0.05; dimensionx=(double)N*dx; dimensiony=(double)N*dy; theta=(double)atof(argv[1]); phi=(double)atof(argv[2]); Tmax=atoi(argv[3]); fptr=fopen("3d.gif","w+"); pl_parampl ("BG_COLOR", "white"); pl_parampl ("BITMAPSIZE", "250x250"); pl_parampl ("TRANSPARENT_COLOR", "white"); pl_parampl ("GIF_ITERATIONS", "100"); pl_parampl ("GIF_DELAY", "3"); pl_handle = pl_newpl ("GIF", stdin, fptr, stderr); pl_selectpl (pl_handle); if (pl_openpl () < 0) /* open Plotter */ { fprintf (stderr, "Couldn't open Plotter\n"); return 1; } pl_fspace (-0.71*dimensionx, -0.71*dimensiony,0.71*dimensionx, 0.71*dimensiony); pl_flinewidth (0.01); for(time=1;time=0) return(A-B*(A/B)); else{ do{A=A+B;}while(A<0); return(A);} }