--- ray/src/gen/gensurf.c 2004/03/23 15:18:09 2.14 +++ ray/src/gen/gensurf.c 2010/12/08 21:37:51 2.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: gensurf.c,v 2.14 2004/03/23 15:18:09 greg Exp $"; +static const char RCSid[] = "$Id: gensurf.c,v 2.19 2010/12/08 21:37:51 greg Exp $"; #endif /* * gensurf.c - program to generate functional surfaces @@ -16,6 +16,10 @@ static const char RCSid[] = "$Id: gensurf.c,v 2.14 200 */ #include "standard.h" + +#include "paths.h" +#include "resolu.h" +#include "rterror.h" #include "calcomp.h" char XNAME[] = "X`SYS"; /* x function name */ @@ -30,8 +34,8 @@ char VNAME[] = "valid"; /* valid vertex name */ #define pvect(p) printf(vformat, (p)[0], (p)[1], (p)[2]) -char vformat[] = "%15.9g %15.9g %15.9g\n"; -char tsargs[] = "4 surf_dx surf_dy surf_dz surf.cal\n"; +char vformat[] = "%18.12g %18.12g %18.12g\n"; +char tsargs[] = "4 surf_dx surf_dy surf_dz surf.cal"; char texname[] = "Phong"; int smooth = 0; /* apply smoothing? */ @@ -67,7 +71,6 @@ void putsquare(POINT *p0, POINT *p1, POINT *p2, POINT void comprow(double s, POINT *row, int siz); void compnorms(POINT *r0, POINT *r1, POINT *r2, int siz); int norminterp(FVECT resmat[4], POINT *p0, POINT *p1, POINT *p2, POINT *p3); -void printhead(int ac, char **av); int @@ -135,7 +138,8 @@ char *argv[]; } row0++; row1++; row2++; /* print header */ - printhead(argc, argv); + fputs("# ", stdout); + printargs(argc, argv, stdout); eclock = 0; /* initialize */ comprow(-1.0/m, row0, n); @@ -178,7 +182,7 @@ char *argv[]; userror: fprintf(stderr, "Usage: %s material name ", argv[0]); - fprintf(stderr, "x(s,t) y(s,t) z(s,t) m n [-s][-e expr][-f file]\n"); + fprintf(stderr, "x(s,t) y(s,t) z(s,t) m n [-s][-o][-e expr][-f file]\n"); return 1; } @@ -378,8 +382,7 @@ putsquare( /* put out a square */ if (ok1 & ok2 && fdot(vc1,vc2) >= 1.0-FTINY*FTINY) { printf("\n%s ", modname); if (axis != -1) { - printf("texfunc %s\n", texname); - printf(tsargs); + printf("texfunc %s\n%s\n", texname, tsargs); printf("0\n13\t%d\n", axis); pvect(norm[0]); pvect(norm[1]); @@ -401,8 +404,7 @@ putsquare( /* put out a square */ if (ok1) { printf("\n%s ", modname); if (axis != -1) { - printf("texfunc %s\n", texname); - printf(tsargs); + printf("texfunc %s\n%s\n", texname, tsargs); printf("0\n13\t%d\n", axis); pvect(norm[0]); pvect(norm[1]); @@ -420,8 +422,7 @@ putsquare( /* put out a square */ if (ok2) { printf("\n%s ", modname); if (axis != -1) { - printf("texfunc %s\n", texname); - printf(tsargs); + printf("texfunc %s\n%s\n", texname, tsargs); printf("0\n13\t%d\n", axis); pvect(norm[0]); pvect(norm[1]); @@ -581,45 +582,6 @@ norminterp( /* compute normal interpolation */ #undef u #undef v -} - - -void -eputs(msg) -char *msg; -{ - fputs(msg, stderr); -} - - -void -wputs(msg) -char *msg; -{ - eputs(msg); -} - - -void -quit(code) -int code; -{ - exit(code); -} - - -void -printhead( /* print command header */ - register int ac, - register char **av -) -{ - putchar('#'); - while (ac--) { - putchar(' '); - fputs(*av++, stdout); - } - putchar('\n'); }