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

Comparing ray/src/rt/pmapdata.c (file contents):
Revision 2.8 by rschregle, Tue May 26 13:31:19 2015 UTC vs.
Revision 2.11 by greg, Tue Aug 18 18:45:55 2015 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5     ==================================================================
6     Photon map data structures and kd-tree handling
# Line 337 | Line 340 | void findPhotons (PhotonMap* pmap, const RAY* ray)
340        pmap -> minError = FHUGE;
341        pmap -> maxError = -FHUGE;
342        pmap -> rmsError = 0;
343 <      /* Maximum search radius limit is based on avg photon distance to
343 >      /* SQUARED max search radius limit is based on avg photon distance to
344         * centre of gravity, unless fixed by user (maxDistFix > 0) */
345        pmap -> maxDist0 = pmap -> maxDistLimit =
346 <         maxDistFix > 0 ? maxDistFix
346 >         maxDistFix > 0 ? maxDistFix * maxDistFix
347                          : PMAP_MAXDIST_COEFF * pmap -> squeueSize *
348                            pmap -> CoGdist / pmap -> heapSize;
349     }
# Line 362 | Line 365 | void findPhotons (PhotonMap* pmap, const RAY* ray)
365           nearestNeighbours(pmap, pos, norm, 1);
366        }
367  
368 +      if (pmap -> maxDist < FTINY) {
369 +         sprintf(errmsg, "itsy bitsy teeny weeny photon search radius %e",
370 +                 sqrt(pmap -> maxDist));
371 +         error(WARNING, errmsg);
372 +      }
373 +
374        if (pmap -> squeueEnd < pmap -> squeueSize * pmap -> gatherTolerance) {
375           /* Short lookup; too few photons found */
376           if (pmap -> squeueEnd > PMAP_SHORT_LOOKUP_THRESH) {
# Line 392 | Line 401 | void findPhotons (PhotonMap* pmap, const RAY* ray)
401                 sprintf(errmsg,
402                         redo ? "restarting photon lookup with max radius %.1e"
403                              : "max photon lookup radius adjusted to %.1e",
404 <                       pmap -> maxDist0);
404 >                       sqrt(pmap -> maxDist0));
405                 error(WARNING, errmsg);
406   #endif
407              }
408   #ifdef PMAP_LOOKUP_REDO
409              else {
410                 sprintf(errmsg, "max photon lookup radius clamped to %.1e",
411 <                       pmap -> maxDist0);
411 >                       sqrt(pmap -> maxDist0));
412                 error(WARNING, errmsg);
413              }
414   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines