/* * General Parabolic Blending * * Looks better at 4 spaces/tab * */ #include #include #include #ifdef THINK_C #include #endif #ifdef MYGETOPT char getopt( int argc, char *argv[], char *format ); #endif #ifndef true #define true 1 #define false 0 #endif #include "parab.h" #define frand(a) ((-0.5 + ((double)rand()/(double)RAND_MAX))*(a)) #define MAX_DATA 10 void usage(char *name); void set_opts( int argc, char *argv[] ); void DoError(char *str); int get_format(void); static char __ident[] = "@(#)(c) SPDsoft, 28 diciembre 1993. v2"; #define VERS_STR ((char*)&__ident[4]) int NumLines; int Verbose; int SuperSampling; unsigned short int SFPI; double FPS; int Stochastic; int PutTime; int PutPolar; int AbsTime; double Desv; int get_format(void) { int done=0; int i; sz_data=0; tid = -1; did=0; while(!done) { switch(getc(stdin)) { case '%': if(did==MAX_DATA) DoError("Too many data!"); switch(getc(stdin)) { case 'c': case 'C': tdata[did]='c'; sz_data+=3; did++; break; case 'p': case 'P': tdata[did]='p'; sz_data+=3; did++; break; case 'x': case 'X': tdata[did]='x'; sz_data+=1; did++; break; case 't': AbsTime=false; case 'T': tdata[did]='t'; tid=sz_data; sz_data+=1; did++; break; case '\n': done=-2; DoError("Unexpected end of line"); break; case EOF: done=-1; DoError("Unexpected end of file"); break; default: done=-3; DoError("Unexpected format"); break; } break; case '\n': done=1; break; case EOF: done=-1; DoError("Unexpected end of file"); break; default: break; } } if(tid==-1) DoError("No time"); if(tid+1!=sz_data) DoError("Time must be the last token"); for(i=0;i