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.12 by greg, Tue Sep 1 16:27:52 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 8 | Line 11
11     supported by the Swiss National Science Foundation (SNSF, #147053)
12     ==================================================================  
13    
11   $Id$
14   */
15  
16  
# Line 337 | Line 339 | void findPhotons (PhotonMap* pmap, const RAY* ray)
339        pmap -> minError = FHUGE;
340        pmap -> maxError = -FHUGE;
341        pmap -> rmsError = 0;
342 <      /* Maximum search radius limit is based on avg photon distance to
342 >      /* SQUARED max search radius limit is based on avg photon distance to
343         * centre of gravity, unless fixed by user (maxDistFix > 0) */
344        pmap -> maxDist0 = pmap -> maxDistLimit =
345 <         maxDistFix > 0 ? maxDistFix
345 >         maxDistFix > 0 ? maxDistFix * maxDistFix
346                          : PMAP_MAXDIST_COEFF * pmap -> squeueSize *
347                            pmap -> CoGdist / pmap -> heapSize;
348     }
# Line 362 | Line 364 | void findPhotons (PhotonMap* pmap, const RAY* ray)
364           nearestNeighbours(pmap, pos, norm, 1);
365        }
366  
367 +      if (pmap -> maxDist < FTINY) {
368 +         sprintf(errmsg, "itsy bitsy teeny weeny photon search radius %e",
369 +                 sqrt(pmap -> maxDist));
370 +         error(WARNING, errmsg);
371 +      }
372 +
373        if (pmap -> squeueEnd < pmap -> squeueSize * pmap -> gatherTolerance) {
374           /* Short lookup; too few photons found */
375           if (pmap -> squeueEnd > PMAP_SHORT_LOOKUP_THRESH) {
# Line 392 | Line 400 | void findPhotons (PhotonMap* pmap, const RAY* ray)
400                 sprintf(errmsg,
401                         redo ? "restarting photon lookup with max radius %.1e"
402                              : "max photon lookup radius adjusted to %.1e",
403 <                       pmap -> maxDist0);
403 >                       sqrt(pmap -> maxDist0));
404                 error(WARNING, errmsg);
405   #endif
406              }
407   #ifdef PMAP_LOOKUP_REDO
408              else {
409                 sprintf(errmsg, "max photon lookup radius clamped to %.1e",
410 <                       pmap -> maxDist0);
410 >                       sqrt(pmap -> maxDist0));
411                 error(WARNING, errmsg);
412              }
413   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines