How to Solve for Ray-Sphere Intersection Algebraically

  • Thread starter Thread starter Bucky
  • Start date Start date
  • Tags Tags
    Intersection
Click For Summary
SUMMARY

The discussion focuses on solving the ray-sphere intersection algebraically, specifically the expansion of the equation to find the intersection parameter t. The equation is derived from setting the ray equation equal to the sphere's center, leading to the quadratic form: (d.d)t² + 2(o - c).dt + (o - c) - r² = 0. The confusion arises from misapplying the expansion of the dot product, where (o - c) should be treated as a single term rather than expanding it incorrectly. The correct approach involves using the distributive and commutative properties of the dot product.

PREREQUISITES
  • Understanding of vector algebra and dot products
  • Familiarity with quadratic equations
  • Knowledge of ray-sphere intersection concepts
  • Basic proficiency in algebraic manipulation
NEXT STEPS
  • Study the properties of dot products in vector mathematics
  • Learn about quadratic equations and their solutions
  • Explore geometric interpretations of ray-sphere intersections
  • Review algebraic techniques for expanding expressions
USEFUL FOR

Mathematicians, computer graphics developers, game developers, and anyone interested in geometric algorithms and ray tracing techniques.

Bucky
Messages
79
Reaction score
0
I'm trying to work through an explanation of how a ray-sphere intersection can be solved algebraically from here:
http://wiki.cgsociety.org/index.php/Ray_Sphere_Intersection

My problem is at this step:

we can find the t at which the ray intersects the sphere by setting ray(t) equal to p

(o + t d - c) . (o + t d - c) = r^2


To solve for t we first expand the above into a more recognisable quadratic equation form

(d.d)t^2 + 2 (o - c) . dt + (o - c) - r^2 = 0

I don't understand how they've expanded the formula.

I thought you just multiplied each term in the left bracket by each term in the right bracket...which gave me...

(o.o) + (c.c) - 2(c.o) - 2(d.c) + 2t(d.o) + t^2 (d.d) = r^2


Have I made a mistake or is there some trick I'm missing?
 
Last edited by a moderator:
Physics news on Phys.org
You're expanding it out too far. The idea is to get it in a quadratic form. You treated it as three terms being squared and they treated it as two terms. Treat (o-c) as one term in the initial brackets and td as the other term. Then expand keeping (o-c) together as one term.
 
There isn't any trick. Just apply the distributive and commutative property of dot product to the vectors.
 

Similar threads

Replies
4
Views
1K
Replies
4
Views
1K
  • · Replies 21 ·
Replies
21
Views
4K
Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
1K
  • · Replies 16 ·
Replies
16
Views
1K