Cosmo Kramer
New member
- Joined
- Dec 14, 2020
- Messages
- 2
Hi,
In the expressions below "A" is the origin vector, "t" is a constant, "b" is the direction vector and "C" is the sphere center vector, "r^2" - sphere's radius squared and "⋅" is (afaik) a dot product operation.
It's about testing if a 3D point is inside a sphere:
(P - C) ⋅ (P - C) = r^2
"P" is the point, "C" - sphere's center. However "P" is really a ray defined by P(t) = A + tb, so:
(A + tb - C) ⋅ (A + tb - C) = r^2
And at this point I'm stuck because I don't understand how it got expanded to:
t^2b ⋅ b + 2tb ⋅ (A - C) + (A - C) ⋅ (A - C) - r^2 = 0
because I've seen a dot product of two binomials but never of trinomials.
In the expressions below "A" is the origin vector, "t" is a constant, "b" is the direction vector and "C" is the sphere center vector, "r^2" - sphere's radius squared and "⋅" is (afaik) a dot product operation.
It's about testing if a 3D point is inside a sphere:
(P - C) ⋅ (P - C) = r^2
"P" is the point, "C" - sphere's center. However "P" is really a ray defined by P(t) = A + tb, so:
(A + tb - C) ⋅ (A + tb - C) = r^2
And at this point I'm stuck because I don't understand how it got expanded to:
t^2b ⋅ b + 2tb ⋅ (A - C) + (A - C) ⋅ (A - C) - r^2 = 0
because I've seen a dot product of two binomials but never of trinomials.