Ray-Sphere Intersection

1. Aug 3, 2008

Bucky

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 [Broken]

My problem is at this step:

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: Apr 23, 2017 at 2:41 PM
2. Aug 3, 2008