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 2.2 by greg, Tue Mar 3 21:30:03 1992 UTC vs.
Revision 2.6 by greg, Mon Mar 10 17:26:26 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char RCSid[] = "$Id";
3   #endif
6
4   /*
5   * Replace markers in Radiance scene description with objects or instances.
6   *
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
8   */
9  
10   #include <stdio.h>
11 + #include <stdlib.h>
12   #include <ctype.h>
13   #include <math.h>
14  
15   #include "fvect.h"
16  
17   #ifdef  M_PI
18 < #define  PI             M_PI
18 > #define  PI             ((double)M_PI)
19   #else
20   #define  PI             3.14159265358979323846
21   #endif
# Line 170 | Line 168 | cvobject(fname, fin)           /* convert an object */
168   char    *fname;
169   FILE    *fin;
170   {
171 +        extern char     *fgetword();
172          char    buf[128], typ[16], nam[128];
173          int     i, n;
174          register int    j;
# Line 194 | Line 193 | FILE   *fin;
193                          goto readerr;
194                  printf("%d", n);
195                  for (j = 0; j < n; j++) {
196 <                        if (fscanf(fin, "%s", buf) != 1)
196 >                        if (fgetword(buf, sizeof(buf), fin) == NULL)
197                                  goto readerr;
198                          if (j%3 == 0)
199                                  putchar('\n');
200 <                        printf("\t%s", buf);
200 >                        putchar('\t');
201 >                        fputword(buf, stdout);
202                  }
203                  putchar('\n');
204          }
# Line 218 | Line 218 | FILE   *fin;
218          int     n;
219          char    buf[256];
220  
221 +        buf[0] = '\0';                  /* bug fix thanks to schorsch */
222          if (m->doxform) {
223                  sprintf(buf, "xform -e -n %s", mark);
224                  if (m->modout != NULL)
# Line 258 | Line 259 | EDGE   *e1, *e2;
259  
260   int
261   buildxf(xf, markscale, fin)             /* build transform for marker */
262 < char    *xf;
262 > register char   *xf;
263   double  markscale;
264   FILE    *fin;
265   {
# Line 325 | Line 326 | FILE   *fin;
326          if (markscale > 0.0) {          /* add scale factor */
327                  sprintf(xf, " -s %f", xlen*markscale);
328                  n += 2;
329 <                xf += strlen(xf);
329 >                while (*xf) ++xf;
330          }
331                                          /* add rotation */
332          n += addrot(xf, xvec, yvec, zvec);
333 <        xf += strlen(xf);
333 >        while (*xf) ++xf;
334                                          /* add translation */
335          n += 4;
336          sprintf(xf, " -t %f %f %f", vlist[elist[1].beg][0],
# Line 339 | Line 340 | FILE   *fin;
340  
341  
342   addrot(xf, xp, yp, zp)          /* compute rotation (x,y,z) => (xp,yp,zp) */
343 < char    *xf;
343 > register char   *xf;
344   FVECT   xp, yp, zp;
345   {
346          int     n;
# Line 349 | Line 350 | FVECT  xp, yp, zp;
350          theta = atan2(yp[2], zp[2]);
351          if (!FEQ(theta,0.0)) {
352                  sprintf(xf, " -rx %f", theta*(180./PI));
353 <                xf += strlen(xf);
353 >                while (*xf) ++xf;
354                  n += 2;
355          }
356          theta = asin(-xp[2]);
357          if (!FEQ(theta,0.0)) {
358                  sprintf(xf, " -ry %f", theta*(180./PI));
359 <                xf += strlen(xf);
359 >                while (*xf) ++xf;
360                  n += 2;
361          }
362          theta = atan2(xp[1], xp[0]);
363          if (!FEQ(theta,0.0)) {
364                  sprintf(xf, " -rz %f", theta*(180./PI));
365 <                /* xf += strlen(xf); */
365 >                /* while (*xf) ++xf; */
366                  n += 2;
367          }
368          return(n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines