optimize summation

This commit is contained in:
numzero 2025-11-16 18:04:18 +03:00
parent aa56768655
commit bb8373fad5

View File

@ -257,6 +257,9 @@ impl Core {
let mut value = 0.0f32; let mut value = 0.0f32;
for light_hit in &hits { for light_hit in &hits {
let d2 = hit.base.distance_squared(light_hit.base); let d2 = hit.base.distance_squared(light_hit.base);
if d2 > 3. * sigma2 {
continue;
}
let w = (-0.5 * d2 / sigma2).exp(); let w = (-0.5 * d2 / sigma2).exp();
value += w; value += w;
} }