ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/replmarks.c
(Generate patch)

Comparing ray/src/gen/replmarks.c (file contents):
Revision 1.1 by greg, Sun Feb 17 22:36:30 1991 UTC vs.
Revision 1.2 by greg, Mon Feb 18 13:45:12 1991 UTC

# Line 22 | Line 22 | static char SCCSid[] = "$SunId$ LBL";
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 {
# Line 31 | Line 33 | 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  
# Line 202 | Line 204 | FILE   *fin;
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);
# Line 213 | Line 217 | FILE   *fin;
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:
# Line 321 | Line 324 | addrot(xf, xp, yp, zp)         /* compute rotation (x,y,z) =>
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines