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 1.14 by greg, Tue Apr 2 16:47:03 1991 UTC vs.
Revision 1.16 by greg, Wed Apr 10 15:59:07 1991 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include "glare.h"
14  
15 #include "random.h"
16
15   #define FEQ(a,b)        ((a)-(b)<=FTINY&&(a)-(b)<=FTINY)
16   #define VEQ(v1,v2)      (FEQ((v1)[0],(v2)[0])&&FEQ((v1)[1],(v2)[1]) \
17                                  &&FEQ((v1)[2],(v2)[2]))
# Line 50 | Line 48 | main(argc, argv)
48   int     argc;
49   char    *argv[];
50   {
51 +        int     combine = 1;
52          int     gotview = 0;
53          int     rval, i;
54          char    *err;
# Line 103 | Line 102 | char   *argv[];
102                  case 'p':
103                          picture = argv[++i];
104                          break;
105 +                case 'c':
106 +                        combine = !combine;
107 +                        break;
108                  case 'd':
109                  case 'l':
110                          rtargv[rtargc++] = argv[i];
# Line 181 | Line 183 | char   *argv[];
183          if (threshold <= FTINY)
184                  comp_thresh();                  /* compute glare threshold */
185          analyze();                              /* analyze view */
186 +        if (combine)
187 +                absorb_specks();                /* eliminate tiny sources */
188          cleanup();                              /* tidy up */
189                                                  /* print header */
190          printargs(argc, argv, stdout);
# Line 292 | Line 296 | compdir(vd, x, y)                      /* compute direction for x,y */
296   FVECT   vd;
297   int     x, y;
298   {
299 +        static int      cury = 10000;
300 +        static double   err, cmpval;
301          long    t;
302          FVECT   org;                    /* dummy variable */
303  
# Line 305 | Line 311 | int    x, y;
311                                  (double)y/(2*sampdens)+.5));
312                                          /* central region */
313                                  /* avoid over-counting of poles */
314 <        t = random() % vsize;
315 <        if (t*t >= (long)vsize*vsize - (long)y*y)
314 >        if (cury != y) {
315 >                err = 0.0;
316 >                cmpval = sqrt(1.0 - (double)((long)y*y)/((long)vsize*vsize));
317 >                cury = y;
318 >        }
319 >        err += cmpval;
320 >        if (err <= 0.5)
321                  return(-1);
322 +        err -= 1.0;
323          if (viewray(org, vd, &ourview, .5, (double)y/(2*sampdens)+.5) < 0)
324                  return(-1);
325          spinvector(vd, vd, ourview.vup, h_theta(x));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines