15 |
|
*/ |
16 |
|
|
17 |
|
#include <stdio.h> |
18 |
+ |
#include <math.h> |
19 |
|
|
20 |
< |
#define ZNAME "Z_" /* z function name */ |
21 |
< |
#define RNAME "R_" /* r function name */ |
20 |
> |
#define ZNAME "Z`SYS`" /* z function name */ |
21 |
> |
#define RNAME "R`SYS`" /* r function name */ |
22 |
|
|
23 |
|
#define PI 3.14159265358979323846 |
24 |
|
|
36 |
|
int argc; |
37 |
|
char *argv[]; |
38 |
|
{ |
39 |
+ |
extern long eclock; |
40 |
|
char stmp[256]; |
41 |
|
char *modname; |
42 |
|
int smooth = 0; |
45 |
|
int i, nseg; |
46 |
|
int orient; |
47 |
|
|
48 |
< |
varset("PI", PI); |
49 |
< |
funset("hermite", 5, l_hermite); |
50 |
< |
funset("bezier", 5, l_bezier); |
51 |
< |
funset("bspline", 5, l_bspline); |
48 |
> |
varset("PI", ':', PI); |
49 |
> |
funset("hermite", 5, ':', l_hermite); |
50 |
> |
funset("bezier", 5, ':', l_bezier); |
51 |
> |
funset("bspline", 5, ':', l_bspline); |
52 |
|
|
53 |
|
if (argc < 6) |
54 |
|
goto userror; |
55 |
|
|
56 |
|
for (i = 6; i < argc; i++) |
57 |
|
if (!strcmp(argv[i], "-e")) |
58 |
< |
scompile(NULL, argv[++i]); |
58 |
> |
scompile(argv[++i], NULL, 0); |
59 |
|
else if (!strcmp(argv[i], "-f")) |
60 |
|
fcompile(argv[++i]); |
61 |
|
else if (!strcmp(argv[i], "-s")) |
64 |
|
goto userror; |
65 |
|
|
66 |
|
sprintf(stmp, "%s(t)=%s;", ZNAME, argv[3]); |
67 |
< |
scompile(NULL, stmp); |
67 |
> |
scompile(stmp, NULL, 0); |
68 |
|
sprintf(stmp, "%s(t)=%s;", RNAME, argv[4]); |
69 |
< |
scompile(NULL, stmp); |
69 |
> |
scompile(stmp, NULL, 0); |
70 |
|
nseg = atoi(argv[5]); |
71 |
|
if (nseg <= 0) |
72 |
|
goto userror; |
73 |
|
modname = smooth ? "Phong" : argv[1]; |
74 |
|
|
75 |
|
printhead(argc, argv); |
76 |
+ |
eclock = 0; |
77 |
|
|
78 |
|
lastnz = lastnr = 0.0; |
79 |
|
t = 0.0; |
161 |
|
computen(nzp, nrp, z0, r0, z1, r1) /* compute normal */ |
162 |
|
double *nzp, *nrp, z0, r0, z1, r1; |
163 |
|
{ |
161 |
– |
extern double sqrt(); |
164 |
|
double dr, dz, len; |
165 |
|
|
166 |
|
dz = r0 - r1; /* right angle vector */ |