Skip to content

Intersection of a ray and a plane by assist

Piotr Biedermann edited this page Jan 11, 2023 · 1 revision

First, let's talk about the intersection of a ray and a plane.

For this, we will use the same starting point and direction vector for the ray as in the previous example: R = (1, 2, 3) and D = (4, 5, 6). And let's say the plane is defined by a point on the plane P = (x0, y0, z0) and the normal vector to the plane N = (a, b, c).

Here's the basic algorithm for determining if the ray intersects the plane:

Compute the parameter of the point of intersection t using the following formula: t = ( ( P - R ) . N ) / ( D . N ) where (P - R) is the vector pointing from the origin of the ray to a point on the plane Check if t is greater than or equal to zero. If it is, then the ray intersects the plane, and the point of intersection is given by: P = R + tD As an example, let's use the same ray R and D, and a point on the plane P = (10, 20, 30) and a normal vector to the plane N = (1, 2, 3)

Compute the parameter t: t = ( (10-1, 20-2, 30-3) . (1,2,3) ) / (41 + 52 + 6*3) = -8/29 t is negative, so the ray doesn't intersect the plane.