fx: sphere hit calculation sometimes picking wrong isct point

This commit is contained in:
djaidjai committed 2026-04-20 19:59:22 +02:00
1 parent 66c6bf438b
commit 6bf65eb60c
3 files changed
+5 -3

No files matched your search

+3 -1
View File
@@ -42,7 +42,9 @@ impl Hittable for Sphere {
if d < 0. {
None
} else {
let t = (h - sqrt(d)) / a;
let tl = (h - sqrt(d)) / a;
let tr = (h + sqrt(d)) / a;
let t = if tl > 0.001 { tl } else { tr };
let p = r.at(t);
let out_n = (p - self.center) / self.radius;
Some(Hit::new(
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.