22 |
|
#define PI 3.14159265358979323846 |
23 |
|
#endif |
24 |
|
|
25 |
+ |
#define FEQ(a,b) ((a)-(b) <= 1e-7 && (b)-(a) <= 1e-7) |
26 |
+ |
|
27 |
|
#define MAXVERT 6 /* maximum number of vertices for markers */ |
28 |
|
|
29 |
|
typedef struct { |
33 |
|
|
34 |
|
int expand = 0; /* expand commands? */ |
35 |
|
|
36 |
< |
char *modout = "void"; /* output modifier (for instances) */ |
36 |
> |
char *modout = NULL; /* output modifier (for instances) */ |
37 |
|
|
38 |
|
double markscale = 0.0; /* scale markers by this to get unit */ |
39 |
|
|
204 |
|
|
205 |
|
if (doxform) { |
206 |
|
sprintf(buf, "xform -e -n %s", mark); |
207 |
+ |
if (modout != NULL) |
208 |
+ |
sprintf(buf+strlen(buf), " -m %s", modout); |
209 |
|
if (buildxf(buf+strlen(buf), fin) < 0) |
210 |
|
goto badxf; |
211 |
|
sprintf(buf+strlen(buf), " %s", objname); |
217 |
|
} else { |
218 |
|
if ((n = buildxf(buf, fin)) < 0) |
219 |
|
goto badxf; |
220 |
< |
printf("\n%s instance %s\n", modout, mark); |
221 |
< |
printf("%d %s%s\n", n+1, objname, buf); |
218 |
< |
printf("\n0\n0\n"); |
220 |
> |
printf("\n%s instance %s\n", modout==NULL?"void":modout, mark); |
221 |
> |
printf("%d %s%s\n0\n0\n", n+1, objname, buf); |
222 |
|
} |
223 |
|
return; |
224 |
|
badxf: |
324 |
|
char *xf; |
325 |
|
FVECT xp, yp, zp; |
326 |
|
{ |
327 |
< |
double tx, ty, tz; |
327 |
> |
int n; |
328 |
> |
double theta; |
329 |
|
|
330 |
< |
tx = atan2(yp[2], zp[2]); |
331 |
< |
ty = asin(-xp[2]); |
332 |
< |
tz = atan2(xp[1], xp[0]); |
333 |
< |
sprintf(xf, " -rx %f -ry %f -rz %f", tx*(180./PI), |
334 |
< |
ty*(180./PI), tz*(180./PI)); |
335 |
< |
return(6); |
330 |
> |
n = 0; |
331 |
> |
theta = atan2(yp[2], zp[2]); |
332 |
> |
if (!FEQ(theta,0.0)) { |
333 |
> |
sprintf(xf, " -rx %f", theta*(180./PI)); |
334 |
> |
xf += strlen(xf); |
335 |
> |
n += 2; |
336 |
> |
} |
337 |
> |
theta = asin(-xp[2]); |
338 |
> |
if (!FEQ(theta,0.0)) { |
339 |
> |
sprintf(xf, " -ry %f", theta*(180./PI)); |
340 |
> |
xf += strlen(xf); |
341 |
> |
n += 2; |
342 |
> |
} |
343 |
> |
theta = atan2(xp[1], xp[0]); |
344 |
> |
if (!FEQ(theta,0.0)) { |
345 |
> |
sprintf(xf, " -rz %f", theta*(180./PI)); |
346 |
> |
/* xf += strlen(xf); */ |
347 |
> |
n += 2; |
348 |
> |
} |
349 |
> |
return(n); |
350 |
|
} |