# Line–plane intersection

(Redirected from Line-plane intersection)
The three possible plane-line relationships:
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 in computer graphics, motion planning, and collision detection.

## Algebraic form

In vector notation, a plane can be expressed as the set of points ${\displaystyle \mathbf {p} }$ for which

${\displaystyle (\mathbf {p} -\mathbf {p_{0}} )\cdot \mathbf {n} =0}$

where ${\displaystyle \mathbf {n} }$ is a normal vector to the plane and ${\displaystyle \mathbf {p_{0}} }$ is a point on the plane. (The notation ${\displaystyle \mathbf {a} \cdot \mathbf {b} }$ denotes the dot product of the vectors ${\displaystyle \mathbf {a} }$ and ${\displaystyle \mathbf {b} }$.)

The vector equation for a line is

${\displaystyle \mathbf {p} =d\mathbf {l} +\mathbf {l_{0}} \quad d\in \mathbb {R} }$

where ${\displaystyle \mathbf {l} }$ is a vector in the direction of the line, ${\displaystyle \mathbf {l_{0}} }$ is a point on the line, and ${\displaystyle d}$ is a scalar in the real number domain. Substituting the equation for the line into the equation for the plane gives

${\displaystyle (d\mathbf {l} +\mathbf {l_{0}} -\mathbf {p_{0}} )\cdot \mathbf {n} =0.}$

Expanding gives

${\displaystyle d\mathbf {l} \cdot \mathbf {n} +(\mathbf {l_{0}} -\mathbf {p_{0}} )\cdot \mathbf {n} =0.}$

And solving for ${\displaystyle d}$ gives

${\displaystyle d={(\mathbf {p_{0}} -\mathbf {l_{0}} )\cdot \mathbf {n} \over \mathbf {l} \cdot \mathbf {n} }.}$

If ${\displaystyle \mathbf {l} \cdot \mathbf {n} =0}$ then the line and plane are parallel. There will be two cases: if ${\displaystyle (\mathbf {p_{0}} -\mathbf {l_{0}} )\cdot \mathbf {n} =0}$ then the line is contained in the plane, that is, the line intersects the plane at each point of the line. Otherwise, the line and plane have no intersection.

If ${\displaystyle \mathbf {l} \cdot \mathbf {n} \neq 0}$ there is a single point of intersection. The value of ${\displaystyle d}$ can be calculated and the point of intersection is given by

${\displaystyle d\mathbf {l} +\mathbf {l_{0}} }$.

## Parametric form

The intersection of line and plane.

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

${\displaystyle \mathbf {l} _{a}+(\mathbf {l} _{b}-\mathbf {l} _{a})t,\quad t\in \mathbb {R} }$

where ${\displaystyle \mathbf {l} _{a}=(x_{a},y_{a},z_{a})}$ and ${\displaystyle \mathbf {l} _{b}=(x_{b},y_{b},z_{b})}$ are two distinct points along the line.

Similarly a general point on a plane can be represented as

${\displaystyle \mathbf {p} _{0}+(\mathbf {p} _{1}-\mathbf {p} _{0})u+(\mathbf {p} _{2}-\mathbf {p} _{0})v,\quad u,v\in \mathbb {R} }$

where ${\displaystyle \mathbf {p} _{k}=(x_{k},y_{k},z_{k})}$, ${\displaystyle k=0,1,2}$ are three points in the plane which are not co-linear.

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

${\displaystyle \mathbf {l} _{a}+(\mathbf {l} _{b}-\mathbf {l} _{a})t=\mathbf {p} _{0}+(\mathbf {p} _{1}-\mathbf {p} _{0})u+(\mathbf {p} _{2}-\mathbf {p} _{0})v}$

This can be rewritten as

${\displaystyle \mathbf {l} _{a}-\mathbf {p} _{0}=(\mathbf {l} _{a}-\mathbf {l} _{b})t+(\mathbf {p} _{1}-\mathbf {p} _{0})u+(\mathbf {p} _{2}-\mathbf {p} _{0})v,}$

which can be expressed in matrix form as:

${\displaystyle {\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

${\displaystyle \mathbf {l} _{a}+(\mathbf {l} _{b}-\mathbf {l} _{a})t}$

If the line is parallel to the plane then the vectors ${\displaystyle \mathbf {l} _{b}-\mathbf {l} _{a}}$, ${\displaystyle \mathbf {p} _{1}-\mathbf {p} _{0}}$, and ${\displaystyle \mathbf {p} _{2}-\mathbf {p} _{0}}$ will be linearly dependent and the matrix will be singular. This situation will also occur when the line lies in the plane.

If the solution satisfies the condition ${\displaystyle t\in [0,1],}$, then the intersection point is on the line between ${\displaystyle \mathbf {l} _{a}}$ and ${\displaystyle \mathbf {l} _{b}}$.

If the solution satisfies

${\displaystyle 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 ${\displaystyle \mathbf {p} _{0}}$, ${\displaystyle \mathbf {p} _{1}}$ and ${\displaystyle \mathbf {p} _{2}}$.

This problem is solved by inverting the matrix:

${\displaystyle {\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}}.}$

## Uses

In the ray tracing method of computer graphics a surface can be represented as a set of pieces of planes. The intersection of a ray of light with each plane is used to produce an image of the surface. In vision-based 3D reconstruction, a subfield of computer vision, depth values are commonly measured by so-called triangulation method, which finds the intersection between light plane and ray reflected toward camera.

The algorithm can be generalised to cover intersection with other planar figures, in particular, the intersection of a polyhedron with a line.