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

Comparing ray/src/util/findglare.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:19:13 1991 UTC vs.
Revision 2.9 by greg, Sat Feb 22 02:07:30 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 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   * Find glare sources in a scene or image.
6   *
# Line 16 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13   #define VEQ(v1,v2)      (FEQ((v1)[0],(v2)[0])&&FEQ((v1)[1],(v2)[1]) \
14                                  &&FEQ((v1)[2],(v2)[2]))
15  
16 < char    *rtargv[32] = {"rtrace", "-h-", "-ov", "-fff"};
17 < int     rtargc = 4;
16 > char    *rtargv[64] = {"rtrace", "-h-", "-ov", "-fff", "-ld-", "-i-", "-I-"};
17 > int     rtargc = 7;
18  
19   VIEW    ourview = STDVIEW;              /* our view */
20   VIEW    pictview = STDVIEW;             /* picture view */
# Line 55 | Line 52 | char   *argv[];
52          progname = argv[0];
53                                          /* process options */
54          for (i = 1; i < argc && argv[i][0] == '-'; i++) {
55 +                                                /* expand arguments */
56 +                while ((rval = expandarg(&argc, &argv, i)) > 0)
57 +                        ;
58 +                if (rval < 0) {
59 +                        fprintf(stderr, "%s: cannot expand '%s'",
60 +                                        argv[0], argv[i]);
61 +                        exit(1);
62 +                }
63                  rval = getviewopt(&ourview, argc-i, argv+i);
64                  if (rval >= 0) {
65                          i += rval;
# Line 75 | Line 80 | char   *argv[];
80                          }
81                          if (argv[i][2] != 'f')
82                                  goto userr;
83 <                        rval = viewfile(argv[++i], &ourview, 0, 0);
83 >                        rval = viewfile(argv[++i], &ourview, NULL);
84                          if (rval < 0) {
85                                  fprintf(stderr,
86                                  "%s: cannot open view file \"%s\"\n",
# Line 105 | Line 110 | char   *argv[];
110                          combine = !combine;
111                          break;
112                  case 'd':
113 +                        rtargv[rtargc++] = argv[i];
114 +                        if (argv[i][2] != 'v')
115 +                                rtargv[rtargc++] = argv[++i];
116 +                        break;
117                  case 'l':
118 +                        if (argv[i][2] == 'd')
119 +                                break;
120 +                        /* FALL THROUGH */
121 +                case 's':
122 +                case 'P':
123                          rtargv[rtargc++] = argv[i];
124                          rtargv[rtargc++] = argv[++i];
125                          break;
126 +                case 'w':
127 +                        rtargv[rtargc++] = argv[i];
128 +                        break;
129                  case 'a':
130                          rtargv[rtargc++] = argv[i];
131                          if (argv[i][2] == 'v') {
# Line 130 | Line 147 | char   *argv[];
147          }
148                                                  /* get view */
149          if (picture != NULL) {
150 <                rval = viewfile(picture, &pictview, 0, 0);
150 >                rval = viewfile(picture, &pictview, NULL);
151                  if (rval < 0) {
152                          fprintf(stderr, "%s: cannot open picture file \"%s\"\n",
153                                          progname, picture);
# Line 186 | Line 203 | char   *argv[];
203                  absorb_specks();                /* eliminate tiny sources */
204          cleanup();                              /* tidy up */
205                                                  /* print header */
206 +        newheader("RADIANCE", stdout);
207          printargs(argc, argv, stdout);
208          fputs(VIEWSTR, stdout);
209          fprintview(&ourview, stdout);
# Line 305 | Line 323 | cleanup()                              /* close files, wait for children */
323          if (octree != NULL)
324                  done_rtrace();
325          if (npixinvw < 100*npixmiss)
326 <                fprintf(stderr, "%s: warning -- missing %ld%% of samples\n",
327 <                                progname, 100L*npixmiss/npixinvw);
326 >                fprintf(stderr, "%s: warning -- missing %d%% of samples\n",
327 >                                progname, (int)(100L*npixmiss/npixinvw));
328   }
329  
330  
# Line 354 | Line 372 | int    x, y;
372                  xo = x-hl;
373          else
374                  xo = 0;
375 <        disc = 1. - (double)(xo*xo + y*y)/(sampdens*sampdens);
376 <        if (disc <= FTINY)
375 >        disc = 1. - (double)((long)xo*xo + (long)y*y)/((long)sampdens*sampdens);
376 >        if (disc <= FTINY*FTINY)
377                  return(0.);
378          return(1./(sampdens*sampdens*sqrt(disc)));
379   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines