Equation for the intersection of a ray and a sphere is backwards · Issue #1191 · RayTracing/raytracing.github.io · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The math and everything is still correct but that (-1) gets squared out, but all of the ray intersections are from the center to the ray origin. Not the other way around
The text was updated successfully, but these errors were encountered:
Trevor observed that the equation for the ray-sphere intersection was
backwards in that it used (P - C) [center to ray origin] instead of
(C - P) [ray origin to sphere center].
That's all well and good, but it ends up rippling all the way back to
the fundamental sphere equations presented in the text.
Sigh. And I couldn't resist.
In flipping everything so it flows without an odd inversion in the
middle, I also discovered some annoying minus signs that could be
eliminated, plus some bits that needed a tiny bit more explanation.
Quite a bit more work than it originally appeared, but I'm pleased with
the results.
Resolves#1191
Trevor observed that the equation for the ray-sphere intersection was
backwards in that it used (P - C) [center to ray origin] instead of
(C - P) [ray origin to sphere center].
That's all well and good, but it ends up rippling all the way back to
the fundamental sphere equations presented in the text.
Sigh. And I couldn't resist.
In flipping everything so it flows without an odd inversion in the
middle, I also discovered some annoying minus signs that could be
eliminated, plus some bits that needed a tiny bit more explanation.
Quite a bit more work than it originally appeared, but I'm pleased with
the results.
Resolves#1191
It's written as
(P - C)
It should be
(C - P)
The math and everything is still correct but that (-1) gets squared out, but all of the ray intersections are from the center to the ray origin. Not the other way around
The text was updated successfully, but these errors were encountered: