Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equation for the intersection of a ray and a sphere is backwards #1191

Closed
trevordblack opened this issue Jul 29, 2023 · 0 comments
Closed

Equation for the intersection of a ray and a sphere is backwards #1191

trevordblack opened this issue Jul 29, 2023 · 0 comments

Comments

@trevordblack
Copy link
Collaborator

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

@trevordblack trevordblack added this to the v4.0.0-alpha milestone Jul 29, 2023
@trevordblack trevordblack self-assigned this Jul 29, 2023
@trevordblack trevordblack modified the milestones: v4.0.0-alpha, v4.0.0 Jul 29, 2023
@hollasch hollasch assigned hollasch and unassigned trevordblack Aug 18, 2023
hollasch added a commit that referenced this issue Aug 20, 2023
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
@hollasch hollasch modified the milestones: v4.0.0, v4.0.0-alpha.2 Aug 23, 2023
hollasch added a commit that referenced this issue Aug 30, 2023
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
@hollasch hollasch closed this as completed Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants