Intersection of a Ray with a Line and a Plane

The purpose of this paper is to build another "tool" towards more complex intersection calculations based on the Point-Normal form of a line and a plane. This will simply show how to determine the intersection point of a ray with an infinite line or plane as well as the distance to this "hit" point.

written and derived by Kenny Hoff (Oct. 3, 1995)
based on parametric form of a ray and Point-Normal form of a line and a plane


Intersection with a Line

Given the following:

We can easily determine the "hit time" t where the ray intersects the line by substituting the parametric ray function into the point-normal form of the line. Since p(t) defines a point on the ray at time t and the Point-Normal equation defines all points p on the line, substituting this value into the equation results in a function of t that can be used to determine the "hit time" t where the ray's point satisfies the Point-Normal equation of the line:

	n.p = D
	n.p(t) = D
	n.(s+d*t) = D
	(n.s) + (n.d)*t = D

	HitTime t = (D-(n.s)) / (n.d) = distance to point of intersection

NOTE: if (n.d = 0) the ray and the line or plane do not intersect (because the ray and the line or plane are parallel since the normal n is perpendicular to the ray direction d). Also, if the HitTime t is negative, the ray has intersected a line or plane in the opposite direction (should be ignored).

The "hit time" also refers to the distance to the from the ray's starting point s to the intersection point. So now what is the intersection point? We can simply evaluate the parametric function of the ray at the hit time t:

	point of intersection = p(HitTime t) = s + d*(HitTime t)


Intersection with a Plane

Believe it or not, the point of intersection and the distance to the intersection is determined exactly the same as with a line. Alas, the beauty of vector-based calculations! The only difference is that the Point-Normal form represents a plane (instead of a line). The line intersection can be thought of as two-dimensional, but it can be two or three; however, the plane intersection must be three-dimensional.

	PLANE: n.p=D

Except, now n is the normal to the plane and D is the distance along the normal to the plane.