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.15 by greg, Fri Apr 5 14:26:47 1991 UTC vs.
Revision 1.22 by greg, Mon Apr 22 14:56:28 1991 UTC

# Line 36 | Line 36 | ANGLE  glarang[180] = {AEND};          /* glare calculation ang
36   int     nglarangs = 0;
37   double  maxtheta;                       /* maximum angle (in radians) */
38   int     hsize;                          /* horizontal size */
39 int     hlim;                           /* central limit of horizontal */
39  
40   struct illum    *indirect;              /* array of indirect illuminances */
41  
# Line 48 | Line 47 | main(argc, argv)
47   int     argc;
48   char    *argv[];
49   {
50 +        int     combine = 1;
51          int     gotview = 0;
52          int     rval, i;
53          char    *err;
# Line 101 | Line 101 | char   *argv[];
101                  case 'p':
102                          picture = argv[++i];
103                          break;
104 +                case 'c':
105 +                        combine = !combine;
106 +                        break;
107                  case 'd':
108                  case 'l':
109                          rtargv[rtargc++] = argv[i];
# Line 179 | Line 182 | char   *argv[];
182          if (threshold <= FTINY)
183                  comp_thresh();                  /* compute glare threshold */
184          analyze();                              /* analyze view */
185 +        if (combine)
186 +                absorb_specks();                /* eliminate tiny sources */
187          cleanup();                              /* tidy up */
188                                                  /* print header */
189          printargs(argc, argv, stdout);
190          fputs(VIEWSTR, stdout);
191          fprintview(&ourview, stdout);
192 <        printf("\n\n");
192 >        printf("\n");
193 >        fputformat("ascii", stdout);
194 >        printf("\n");
195          printsources();                         /* print glare sources */
196          printillum();                           /* print illuminances */
197          exit(0);
# Line 219 | Line 226 | init()                         /* initialize global variables */
226                  maxtheta = (PI/180.)*glarang[nglarangs-1];
227          else
228                  maxtheta = 0.0;
229 <        hlim = sampdens*maxtheta;
223 <        hsize = hlim + sampdens - 1;
229 >        hsize = hlim(0) + sampdens - 1;
230          if (hsize > (int)(PI*sampdens))
231                  hsize = PI*sampdens;
232          indirect = (struct illum *)calloc(nglardirs, sizeof(struct illum));
# Line 275 | Line 281 | init()                         /* initialize global variables */
281   cleanup()                               /* close files, wait for children */
282   {
283          if (verbose)
284 <                fprintf(stderr, "%s: cleaning up...\n", progname);
284 >                fprintf(stderr, "%s: cleaning up...        \n", progname);
285          if (picture != NULL)
286                  close_pict();
287          if (octree != NULL)
# Line 290 | Line 296 | compdir(vd, x, y)                      /* compute direction for x,y */
296   FVECT   vd;
297   int     x, y;
298   {
299 <        static int      cury = 10000;
294 <        static double   err, cmpval;
295 <        long    t;
299 >        int     hl;
300          FVECT   org;                    /* dummy variable */
301  
302 <        if (x <= -hlim)                 /* left region */
302 >        hl = hlim(y);
303 >        if (x <= -hl) {                 /* left region */
304 >                if (x <= -hl-sampdens)
305 >                        return(-1);
306                  return(viewray(org, vd, &leftview,
307 <                                (double)(x+hlim)/(2*sampdens)+.5,
307 >                                (double)(x+hl)/(2*sampdens)+.5,
308                                  (double)y/(2*sampdens)+.5));
309 <        if (x >= hlim)                  /* right region */
309 >        }
310 >        if (x >= hl) {                  /* right region */
311 >                if (x >= hl+sampdens)
312 >                        return(-1);
313                  return(viewray(org, vd, &rightview,
314 <                                (double)(x-hlim)/(2*sampdens)+.5,
314 >                                (double)(x-hl)/(2*sampdens)+.5,
315                                  (double)y/(2*sampdens)+.5));
306                                        /* central region */
307                                /* avoid over-counting of poles */
308        if (cury != y) {
309                err = 0.0;
310                cmpval = sqrt(1.0 - (double)((long)y*y)/((long)vsize*vsize));
311                cury = y;
316          }
317 <        err += cmpval;
314 <        if (err <= 0.5)
315 <                return(-1);
316 <        err -= 1.0;
317 >                                        /* central region */
318          if (viewray(org, vd, &ourview, .5, (double)y/(2*sampdens)+.5) < 0)
319                  return(-1);
320 <        spinvector(vd, vd, ourview.vup, h_theta(x));
320 >        spinvector(vd, vd, ourview.vup, h_theta(x,y));
321          return(0);
322 + }
323 +
324 +
325 + double
326 + pixsize(x, y)           /* return the solid angle of pixel at (x,y) */
327 + int     x, y;
328 + {
329 +        register int    hl, xo;
330 +        double  disc;
331 +
332 +        hl = hlim(y);
333 +        if (x < -hl)
334 +                xo = x+hl;
335 +        else if (x > hl)
336 +                xo = x-hl;
337 +        else
338 +                xo = 0;
339 +        disc = 1. - (double)(xo*xo + y*y)/(sampdens*sampdens);
340 +        if (disc <= FTINY)
341 +                return(0.);
342 +        return(1./(sampdens*sampdens*sqrt(disc)));
343   }
344  
345  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines