Line-plane intersection

From Wikipedia, the free encyclopedia

The three possible plane-line intersections: 1. No intersection. 2. Point intersection. 3. Line intersection.
The three possible plane-line intersections:
1. No intersection.
2. Point intersection.
3. Line intersection.

In analytic geometry, the intersection of a line and a plane can be the empty set, a point, or a line. Distinguishing these cases, and determining equations for the point and line in the latter cases have use, for example, in computer graphics, motion planning, and collision detection.

[edit] Equations in 3D Euclidean space

[edit] Parametric form

A line is described by all points that are a given direction from a point. Thus a line can be represented as

\mathbf{p}_a + (\mathbf{p}_b - \mathbf{p}_a)t, \quad t\in \mathbb{R},

where \mathbf{p}_a=(x_a,y_a,z_a) and \mathbf{p}_b=(x_b,y_b,z_b) are two distinct points along the line.

Similarly a plane can be represented as

\mathbf{p}_0 + (\mathbf{p}_1-\mathbf{p}_0)u + (\mathbf{p}_2-\mathbf{p}_0)v, \quad u,v\in\mathbb{R}

where \mathbf{p}_k=(x_k,y_k,z_k), k = 0,1,2 are three points in the plane.

The point at which the line intersects the plane is therefore described by setting the line equal to the plane in the parametric equation:

\mathbf{p}_a + (\mathbf{p}_b - \mathbf{p}_a)t = \mathbf{p}_0 + (\mathbf{p}_1-\mathbf{p}_0)u + (\mathbf{p}_2-\mathbf{p}_0)v

This can be simplified to

\mathbf{p}_a - \mathbf{p}_0 =  (\mathbf{p}_a - \mathbf{p}_b)t + (\mathbf{p}_1-\mathbf{p}_0)u + (\mathbf{p}_2-\mathbf{p}_0)v,

which can be expressed in matrix form as:

\begin{bmatrix} x_a - x_0 \\ y_a - y_0 \\ z_a - z_0 \end{bmatrix}  = \begin{bmatrix} x_a - x_b & x_1 - x_0 & x_2 - x_0 \\ y_a - y_b & y_1 - y_0 & y_2 - y_0 \\ z_a - z_b & z_1 - z_0 & z_2 - z_0 \end{bmatrix} \begin{bmatrix} t \\ u \\ v \end{bmatrix}

The point of intersection is then equal to

\mathbf{p}_a + (\mathbf{p}_b - \mathbf{p}_a)t

[edit] Usage

If the solution satisfies the condition t \in [0,1],, then the intersection point is on the line between \mathbf{p}_a and \mathbf{p}_b.

If the solution satisfies

u,v \in [0,1], \;\;\; (u+v) \leq 1,

then the intersection point is in the plane inside the triangle spanned by the three points \mathbf{p}_0, \mathbf{p}_1 and \mathbf{p}_2.

This problem is typically solved by expressing it in matrix form, and inverting it:

\begin{bmatrix} t \\ u \\ v \end{bmatrix} = \begin{bmatrix} x_a - x_b & x_1 - x_0 & x_2 - x_0 \\ y_a - y_b & y_1 - y_0 & y_2 - y_0 \\ z_a - z_b & z_1 - z_0 & z_2 - z_0 \end{bmatrix}^{-1} \begin{bmatrix} x_a - x_0 \\ y_a - y_0 \\ z_a - z_0 \end{bmatrix}
In other languages