Line–plane intersection
In analytic geometry, the intersection of a line and a plane in three-dimensional space can be the empty set, a point, or a line. It is the entire line if that line is embedded in the plane, and is the empty set if the line is parallel to the plane but outside it. Otherwise, the line cuts through the plane at a single point.
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 [math]\displaystyle{ \mathbf{p} }[/math] for which
- [math]\displaystyle{ (\mathbf{p}-\mathbf{p_0})\cdot\mathbf{n} = 0 }[/math]
where [math]\displaystyle{ \mathbf{n} }[/math] is a normal vector to the plane and [math]\displaystyle{ \mathbf{p_0} }[/math] is a point on the plane. (The notation [math]\displaystyle{ \mathbf{a}\cdot\mathbf{b} }[/math] denotes the dot product of the vectors [math]\displaystyle{ \mathbf{a} }[/math] and [math]\displaystyle{ \mathbf{b} }[/math].)
The vector equation for a line is
- [math]\displaystyle{ \mathbf{p} = \mathbf{l_0} + \mathbf{l}\ d \quad d\in\mathbb{R} }[/math]
where [math]\displaystyle{ \mathbf{l} }[/math] is a unit vector in the direction of the line, [math]\displaystyle{ \mathbf{l_0} }[/math] is a point on the line, and [math]\displaystyle{ d }[/math] is a scalar in the real number domain. Substituting the equation for the line into the equation for the plane gives
- [math]\displaystyle{ ((\mathbf{l_0} + \mathbf{l}\ d) - \mathbf{p_0})\cdot\mathbf{n} = 0. }[/math]
Expanding gives
- [math]\displaystyle{ (\mathbf{l}\cdot\mathbf{n})\ d + (\mathbf{l_0}-\mathbf{p_0})\cdot\mathbf{n} = 0. }[/math]
And solving for [math]\displaystyle{ d }[/math] gives
- [math]\displaystyle{ d = {(\mathbf{p_0}-\mathbf{l_0})\cdot\mathbf{n} \over \mathbf{l}\cdot\mathbf{n}}. }[/math]
If [math]\displaystyle{ \mathbf{l}\cdot\mathbf{n} = 0 }[/math] then the line and plane are parallel. There will be two cases: if [math]\displaystyle{ (\mathbf{p_0}-\mathbf{l_0})\cdot\mathbf{n} =0 }[/math] 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 [math]\displaystyle{ \mathbf{l}\cdot\mathbf{n} \ne 0 }[/math] there is a single point of intersection. The value of [math]\displaystyle{ d }[/math] can be calculated and the point of intersection, [math]\displaystyle{ \mathbf{p} }[/math], is given by
- [math]\displaystyle{ \mathbf{p} = \mathbf{l_0} + \mathbf{l}\ d }[/math].
Parametric form
A line is described by all points that are a given direction from a point. A general point on a line passing through points [math]\displaystyle{ \mathbf{l}_a=(x_a, y_a, z_a) }[/math] and [math]\displaystyle{ \mathbf{l}_b=(x_b, y_b, z_b) }[/math] can be represented as
- [math]\displaystyle{ \mathbf{l}_a + \mathbf{l}_{ab} t, \quad t\in \mathbb{R}, }[/math]
where [math]\displaystyle{ \mathbf{l}_{ab}=\mathbf{l}_b - \mathbf{l}_a }[/math] is the vector pointing from [math]\displaystyle{ \mathbf{l}_a }[/math] to [math]\displaystyle{ \mathbf{l}_b }[/math].
Similarly a general point on a plane determined by the triangle defined by the points [math]\displaystyle{ \mathbf{p}_0=(x_0, y_0, z_0) }[/math], [math]\displaystyle{ \mathbf{p}_1=(x_1, y_1, z_1) }[/math] and [math]\displaystyle{ \mathbf{p}_2=(x_2, y_2, z_2) }[/math] can be represented as
- [math]\displaystyle{ \mathbf{p}_0 + \mathbf{p}_{0 1} u + \mathbf{p}_{0 2} v, \quad u,v\in\mathbb{R}, }[/math]
where [math]\displaystyle{ \mathbf{p}_{0 1} = \mathbf{p}_1 - \mathbf{p}_0 }[/math] is the vector pointing from [math]\displaystyle{ \mathbf{p}_0 }[/math] to [math]\displaystyle{ \mathbf{p}_1 }[/math], and [math]\displaystyle{ \mathbf{p}_{0 2} = \mathbf{p}_2 - \mathbf{p}_0 }[/math] is the vector pointing from [math]\displaystyle{ \mathbf{p}_0 }[/math] to [math]\displaystyle{ \mathbf{p}_2 }[/math].
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:
- [math]\displaystyle{ \mathbf{l}_a + \mathbf{l}_{ab} t = \mathbf{p}_0 + \mathbf{p}_{0 1} u + \mathbf{p}_{0 2} v. }[/math]
This can be rewritten as
- [math]\displaystyle{ \mathbf{l}_a - \mathbf{p}_0 = - \mathbf{l}_{ab} t + \mathbf{p}_{0 1} u + \mathbf{p}_{0 2} v, }[/math]
which can be expressed in matrix form as
- [math]\displaystyle{ \begin{bmatrix} \mathbf{l}_a - \mathbf{p}_0 \end{bmatrix} = \begin{bmatrix} - \mathbf{l}_{ab} & \mathbf{p}_{0 1} & \mathbf{p}_{0 2} \end{bmatrix} \begin{bmatrix} t \\ u \\ v \end{bmatrix}, }[/math]
where the vectors are written as column vectors.
This produces a system of linear equations which can be solved for [math]\displaystyle{ t }[/math], [math]\displaystyle{ u }[/math] and [math]\displaystyle{ v }[/math]. If the solution satisfies the condition [math]\displaystyle{ t \in [0,1], }[/math], then the intersection point is on the line segment between [math]\displaystyle{ \mathbf{l}_a }[/math] and [math]\displaystyle{ \mathbf{l}_b }[/math], otherwise it is elsewhere on the line. Likewise, if the solution satisfies [math]\displaystyle{ u,v \in [0,1], }[/math], then the intersection point is in the parallelogram formed by the point [math]\displaystyle{ \mathbf{p}_0 }[/math] and vectors [math]\displaystyle{ \mathbf{p}_{0 1} }[/math] and [math]\displaystyle{ \mathbf{p}_{0 2} }[/math]. If the solution additionally satisfies [math]\displaystyle{ (u+v) \leq 1 }[/math], then the intersection point lies in the triangle formed by the three points [math]\displaystyle{ \mathbf{p}_0 }[/math], [math]\displaystyle{ \mathbf{p}_1 }[/math] and [math]\displaystyle{ \mathbf{p}_2 }[/math].
The determinant of the matrix can be calculated as
- [math]\displaystyle{ \det(\begin{bmatrix} - \mathbf{l}_{ab} & \mathbf{p}_{0 1} & \mathbf{p}_{0 2} \end{bmatrix}) = -\mathbf{l}_{ab} \cdot (\mathbf{p}_{0 1} \times \mathbf{p}_{0 2}). }[/math]
If the determinant is zero, then there is no unique solution; the line is either in the plane or parallel to it.
If a unique solution exists (determinant is not 0), then it can be found by inverting the matrix and rearranging:
- [math]\displaystyle{ \begin{bmatrix} t \\ u \\ v \end{bmatrix} = \begin{bmatrix} - \mathbf{l}_{ab} & \mathbf{p}_{0 1} & \mathbf{p}_{0 2} \end{bmatrix}^{-1} \begin{bmatrix} \mathbf{l}_a - \mathbf{p}_0 \end{bmatrix}, }[/math]
which expands to
- [math]\displaystyle{ \begin{bmatrix} t \\ u \\ v \end{bmatrix} = \frac{1}{-\mathbf{l}_{ab} \cdot (\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})} \begin{bmatrix} {(\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})}^\mathrm{T} \\ {(\mathbf{p}_{0 2} \times -\mathbf{l}_{ab})}^\mathrm{T} \\ {(-\mathbf{l}_{ab} \times \mathbf{p}_{0 1})}^\mathrm{T} \end{bmatrix} \begin{bmatrix} \mathbf{l}_a - \mathbf{p}_0 \end{bmatrix} }[/math]
and then to
- [math]\displaystyle{ \begin{bmatrix} t \\ u \\ v \end{bmatrix} = \frac{1}{-\mathbf{l}_{ab} \cdot (\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})} \begin{bmatrix} {(\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})} \cdot (\mathbf{l}_a - \mathbf{p}_0) \\ {(\mathbf{p}_{0 2} \times -\mathbf{l}_{ab})} \cdot (\mathbf{l}_a - \mathbf{p}_0) \\ {(-\mathbf{l}_{ab} \times \mathbf{p}_{0 1})} \cdot (\mathbf{l}_a - \mathbf{p}_0) \end{bmatrix}, }[/math]
thus giving the solutions:
- [math]\displaystyle{ t = \frac{{(\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})} \cdot (\mathbf{l}_a - \mathbf{p}_0)}{-\mathbf{l}_{ab} \cdot (\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})} }[/math]
- [math]\displaystyle{ u = \frac{{(\mathbf{p}_{0 2} \times -\mathbf{l}_{ab})} \cdot (\mathbf{l}_a - \mathbf{p}_0)}{-\mathbf{l}_{ab} \cdot (\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})} }[/math]
- [math]\displaystyle{ v = \frac{{(-\mathbf{l}_{ab} \times \mathbf{p}_{0 1})} \cdot (\mathbf{l}_a - \mathbf{p}_0)}{-\mathbf{l}_{ab} \cdot (\mathbf{p}_{0 1} \times \mathbf{p}_{0 2})}. }[/math]
The point of intersection is then equal to
- [math]\displaystyle{ \mathbf{l}_a + \mathbf{l}_{ab}t }[/math]
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.
See also
- Plücker coordinates calculating the intersection when the line is expressed by Plücker coordinates.
- Plane–plane intersection
External links
References
- https://math.libretexts.org/Bookshelves/Calculus/Supplemental_Modules_(Calculus)/Multivariable_Calculus/1%3A_Vectors_in_Space/Intersection_of_a_Line_and_a_Plane
- https://www.storyofmathematics.com/intersection-of-line-and-plane/
cs:Analytická geometrie#Vzájemná poloha dvou rovin v třírozměrném prostoru
Original source: https://en.wikipedia.org/wiki/Line–plane intersection.
Read more |