231 |
|
nearestNeighbours(pmap, pos, norm, node << 1); |
232 |
|
} |
233 |
|
|
234 |
< |
/* Reject photon if normal faces away (ignored for volume photons) */ |
235 |
< |
if (norm && DOT(norm, p -> norm) <= 0.5 * frandom()) |
234 |
> |
/* Reject photon if normal faces away (ignored for volume photons) with |
235 |
> |
* 50% tolerance to account for perturbation; note photon normal is coded |
236 |
> |
* in range [-127,127]. */ |
237 |
> |
if (norm && DOT(norm, p -> norm) <= 63.5 * frandom()) |
238 |
|
return; |
239 |
|
|
240 |
|
if (isContribPmap(pmap) && pmap -> srcContrib) { |
366 |
|
nearestNeighbours(pmap, pos, norm, 1); |
367 |
|
} |
368 |
|
|
369 |
+ |
#ifdef PMAP_ITSYBITSY |
370 |
|
if (pmap -> maxDist < FTINY) { |
371 |
|
sprintf(errmsg, "itsy bitsy teeny weeny photon search radius %e", |
372 |
|
sqrt(pmap -> maxDist)); |
373 |
|
error(WARNING, errmsg); |
374 |
|
} |
375 |
+ |
#endif |
376 |
|
|
377 |
|
if (pmap -> squeueEnd < pmap -> squeueSize * pmap -> gatherTolerance) { |
378 |
|
/* Short lookup; too few photons found */ |
473 |
|
dv [2] = pos [2] - p -> pos [2]; |
474 |
|
d2 = DOT(dv, dv); |
475 |
|
|
476 |
< |
if (d2 < pmap -> maxDist && DOT(norm, p -> norm) > 0.5 * frandom()) { |
477 |
< |
/* Closest photon so far with similar normal */ |
476 |
> |
if (d2 < pmap -> maxDist && DOT(norm, p -> norm) > 63.5 * frandom()) { |
477 |
> |
/* Closest photon so far with similar normal. We allow a 50% tolerance |
478 |
> |
* to account for perturbation in the latter; note the photon normal |
479 |
> |
* is coded in the range [-127,127]. */ |
480 |
|
pmap -> maxDist = d2; |
481 |
|
*photon = p; |
482 |
|
} |