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.4 by gregl, Fri Jan 16 10:48:23 1998 UTC vs.
Revision 2.5 by greg, Sat Feb 22 02:07:24 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  
# Line 27 | Line 25 | static char SCCSid[] = "$SunId$ LBL";
25   #define  MAXVERT        6       /* maximum number of vertices for markers */
26   #define  MAXMARK        32      /* maximum number of markers */
27  
30 #ifdef  DCL_ATOF
31 extern double  atof();
32 #endif
33
28   typedef struct {
29          short   beg, end;               /* beginning and ending vertex */
30          float   len2;                   /* length squared */
# Line 198 | Line 192 | FILE   *fin;
192                          goto readerr;
193                  printf("%d", n);
194                  for (j = 0; j < n; j++) {
195 <                        if (fscanf(fin, "%s", buf) != 1)
195 >                        if (fgetword(buf, sizeof(buf), fin) == NULL)
196                                  goto readerr;
197                          if (j%3 == 0)
198                                  putchar('\n');
199 <                        printf("\t%s", buf);
199 >                        putchar('\t');
200 >                        fputword(buf, stdout);
201                  }
202                  putchar('\n');
203          }
# Line 222 | Line 217 | FILE   *fin;
217          int     n;
218          char    buf[256];
219  
220 +        buf[0] = '\0';                  /* bug fix thanks to schorsch */
221          if (m->doxform) {
222                  sprintf(buf, "xform -e -n %s", mark);
223                  if (m->modout != NULL)
# Line 262 | Line 258 | EDGE   *e1, *e2;
258  
259   int
260   buildxf(xf, markscale, fin)             /* build transform for marker */
261 < char    *xf;
261 > register char   *xf;
262   double  markscale;
263   FILE    *fin;
264   {
# Line 329 | Line 325 | FILE   *fin;
325          if (markscale > 0.0) {          /* add scale factor */
326                  sprintf(xf, " -s %f", xlen*markscale);
327                  n += 2;
328 <                xf += strlen(xf);
328 >                while (*xf) ++xf;
329          }
330                                          /* add rotation */
331          n += addrot(xf, xvec, yvec, zvec);
332 <        xf += strlen(xf);
332 >        while (*xf) ++xf;
333                                          /* add translation */
334          n += 4;
335          sprintf(xf, " -t %f %f %f", vlist[elist[1].beg][0],
# Line 343 | Line 339 | FILE   *fin;
339  
340  
341   addrot(xf, xp, yp, zp)          /* compute rotation (x,y,z) => (xp,yp,zp) */
342 < char    *xf;
342 > register char   *xf;
343   FVECT   xp, yp, zp;
344   {
345          int     n;
# Line 353 | Line 349 | FVECT  xp, yp, zp;
349          theta = atan2(yp[2], zp[2]);
350          if (!FEQ(theta,0.0)) {
351                  sprintf(xf, " -rx %f", theta*(180./PI));
352 <                xf += strlen(xf);
352 >                while (*xf) ++xf;
353                  n += 2;
354          }
355          theta = asin(-xp[2]);
356          if (!FEQ(theta,0.0)) {
357                  sprintf(xf, " -ry %f", theta*(180./PI));
358 <                xf += strlen(xf);
358 >                while (*xf) ++xf;
359                  n += 2;
360          }
361          theta = atan2(xp[1], xp[0]);
362          if (!FEQ(theta,0.0)) {
363                  sprintf(xf, " -rz %f", theta*(180./PI));
364 <                /* xf += strlen(xf); */
364 >                /* while (*xf) ++xf; */
365                  n += 2;
366          }
367          return(n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines