16 |
|
*/ |
17 |
|
|
18 |
|
#include "standard.h" |
19 |
+ |
|
20 |
+ |
#include "paths.h" |
21 |
+ |
#include "resolu.h" |
22 |
+ |
#include "rterror.h" |
23 |
|
#include "calcomp.h" |
24 |
|
|
25 |
|
char XNAME[] = "X`SYS"; /* x function name */ |
34 |
|
|
35 |
|
#define pvect(p) printf(vformat, (p)[0], (p)[1], (p)[2]) |
36 |
|
|
37 |
< |
char vformat[] = "%15.9g %15.9g %15.9g\n"; |
38 |
< |
char tsargs[] = "4 surf_dx surf_dy surf_dz surf.cal\n"; |
37 |
> |
char vformat[] = "%18.12g %18.12g %18.12g\n"; |
38 |
> |
char tsargs[] = "4 surf_dx surf_dy surf_dz surf.cal"; |
39 |
|
char texname[] = "Phong"; |
40 |
|
|
41 |
|
int smooth = 0; /* apply smoothing? */ |
71 |
|
void comprow(double s, POINT *row, int siz); |
72 |
|
void compnorms(POINT *r0, POINT *r1, POINT *r2, int siz); |
73 |
|
int norminterp(FVECT resmat[4], POINT *p0, POINT *p1, POINT *p2, POINT *p3); |
70 |
– |
void printhead(int ac, char **av); |
74 |
|
|
75 |
|
|
76 |
|
int |
138 |
|
} |
139 |
|
row0++; row1++; row2++; |
140 |
|
/* print header */ |
141 |
< |
printhead(argc, argv); |
141 |
> |
fputs("# ", stdout); |
142 |
> |
printargs(argc, argv, stdout); |
143 |
|
eclock = 0; |
144 |
|
/* initialize */ |
145 |
|
comprow(-1.0/m, row0, n); |
182 |
|
|
183 |
|
userror: |
184 |
|
fprintf(stderr, "Usage: %s material name ", argv[0]); |
185 |
< |
fprintf(stderr, "x(s,t) y(s,t) z(s,t) m n [-s][-e expr][-f file]\n"); |
185 |
> |
fprintf(stderr, "x(s,t) y(s,t) z(s,t) m n [-s][-o][-e expr][-f file]\n"); |
186 |
|
return 1; |
187 |
|
} |
188 |
|
|
229 |
|
size--; |
230 |
|
} |
231 |
|
if (size == (m+n+1)*pointsize) { /* no border after all */ |
232 |
< |
dp = (RREAL *)realloc((void *)datarec.data, |
232 |
> |
dp = (RREAL *)realloc(datarec.data, |
233 |
|
m*n*pointsize*sizeof(RREAL)); |
234 |
|
if (dp != NULL) |
235 |
|
datarec.data = dp; |
382 |
|
if (ok1 & ok2 && fdot(vc1,vc2) >= 1.0-FTINY*FTINY) { |
383 |
|
printf("\n%s ", modname); |
384 |
|
if (axis != -1) { |
385 |
< |
printf("texfunc %s\n", texname); |
382 |
< |
printf(tsargs); |
385 |
> |
printf("texfunc %s\n%s\n", texname, tsargs); |
386 |
|
printf("0\n13\t%d\n", axis); |
387 |
|
pvect(norm[0]); |
388 |
|
pvect(norm[1]); |
404 |
|
if (ok1) { |
405 |
|
printf("\n%s ", modname); |
406 |
|
if (axis != -1) { |
407 |
< |
printf("texfunc %s\n", texname); |
405 |
< |
printf(tsargs); |
407 |
> |
printf("texfunc %s\n%s\n", texname, tsargs); |
408 |
|
printf("0\n13\t%d\n", axis); |
409 |
|
pvect(norm[0]); |
410 |
|
pvect(norm[1]); |
422 |
|
if (ok2) { |
423 |
|
printf("\n%s ", modname); |
424 |
|
if (axis != -1) { |
425 |
< |
printf("texfunc %s\n", texname); |
424 |
< |
printf(tsargs); |
425 |
> |
printf("texfunc %s\n%s\n", texname, tsargs); |
426 |
|
printf("0\n13\t%d\n", axis); |
427 |
|
pvect(norm[0]); |
428 |
|
pvect(norm[1]); |
582 |
|
|
583 |
|
#undef u |
584 |
|
#undef v |
584 |
– |
} |
585 |
– |
|
586 |
– |
|
587 |
– |
void |
588 |
– |
eputs(msg) |
589 |
– |
char *msg; |
590 |
– |
{ |
591 |
– |
fputs(msg, stderr); |
592 |
– |
} |
593 |
– |
|
594 |
– |
|
595 |
– |
void |
596 |
– |
wputs(msg) |
597 |
– |
char *msg; |
598 |
– |
{ |
599 |
– |
eputs(msg); |
600 |
– |
} |
601 |
– |
|
602 |
– |
|
603 |
– |
void |
604 |
– |
quit(code) |
605 |
– |
int code; |
606 |
– |
{ |
607 |
– |
exit(code); |
608 |
– |
} |
609 |
– |
|
610 |
– |
|
611 |
– |
void |
612 |
– |
printhead( /* print command header */ |
613 |
– |
register int ac, |
614 |
– |
register char **av |
615 |
– |
) |
616 |
– |
{ |
617 |
– |
putchar('#'); |
618 |
– |
while (ac--) { |
619 |
– |
putchar(' '); |
620 |
– |
fputs(*av++, stdout); |
621 |
– |
} |
622 |
– |
putchar('\n'); |
585 |
|
} |
586 |
|
|
587 |
|
|