1 |
+ |
#ifndef lint |
2 |
+ |
static const char RCSid[] = "$Id$"; |
3 |
+ |
#endif |
4 |
|
/* |
5 |
|
================================================================== |
6 |
|
Photon map data structures and kd-tree handling |
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 |
|
} |
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) { |
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 |