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

Comparing ray/src/hd/rholo3.c (file contents):
Revision 3.31 by gwlarson, Thu Mar 4 10:29:23 1999 UTC vs.
Revision 3.32 by gwlarson, Thu Mar 4 15:44:10 1999 UTC

# Line 264 | Line 264 | int    bi;
264  
265   ambient_list()                  /* compute ambient beam list */
266   {
267 <        long    wtotal = 0;
267 >        int4    wtotal, minrt;
268          double  frac;
269          int     i;
270          register int    j, k;
# Line 275 | Line 275 | ambient_list()                 /* compute ambient beam list */
275          complist = (PACKHEAD *)malloc(complen*sizeof(PACKHEAD));
276          CHECK(complist==NULL, SYSTEM, "out of memory in ambient_list");
277                                          /* compute beam weights */
278 <        k = 0;
278 >        k = 0; wtotal = 0;
279          for (j = 0; hdlist[j] != NULL; j++) {
280                  frac = 512. * VLEN(hdlist[j]->wg[0]) *
281                                  VLEN(hdlist[j]->wg[1]) *
# Line 290 | Line 290 | ambient_list()                 /* compute ambient beam list */
290          }
291                                          /* adjust sample weights */
292          if (vdef(DISKSPACE))
293 <                frac = 1024.*1024.*vflt(DISKSPACE) /
294 <                                (wtotal*sizeof(RAYVAL));
293 >                frac = 1024.*1024.*vflt(DISKSPACE) / (wtotal*sizeof(RAYVAL));
294          else
295 <                frac = 1024.*1024.*16384. / (wtotal*sizeof(RAYVAL));
296 <        if (frac > 1.11 || frac < 0.9)
297 <                for (k = complen; k--; )
298 <                        complist[k].nr = frac*complist[k].nr + 0.5;
295 >                frac = 1024.*1024.*2048. / (wtotal*sizeof(RAYVAL));
296 >        minrt = .02*frac*wtotal/complen + .5;   /* heuristic mimimum */
297 >        if (minrt > RPACKSIZ)
298 >                minrt = RPACKSIZ;
299 >        for (k = complen; k--; )
300 >                if ((complist[k].nr = frac*complist[k].nr + 0.5) < minrt)
301 >                        complist[k].nr = minrt;
302          listpos = 0; lastin = -1;       /* flag initial sort */
303   }
304  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines