Ray and Object Intersections: Sphere
by Otto Wilke otto_wilke@hotmail.com
I am vaguely aware that graphics is normally done with vector operations, generic
solids positioned at the origin, and transformation matrices to move rays to and fro.
I thought it would be interesting to use rectangular coordinates and objects located
anywhere in space and oriented in any direction.
This is one of four files covering the plane, the sphere, the cylinder, and the cone.
INTERSECTION OF A LINE AND A SPHERE
Given a sphere with radius r and center at (h,k,m), then its equation is:
Assign known values of h, k, m, and r.
If P1(x1,y1,z1) and P2(x2,y2,z2) are two points on a line L, then a=(x2-x1), b=(y2-y1), and c=(z2-z1) are
direction numbers of L. The line L on the point P1 and with direction numbers a, b, and c has parametric equations
Asign known values of x1, y1, z1, and a, b, c.