Javascript required
Skip to content Skip to sidebar Skip to footer

Where Does the Line Through Two Points Intersect a Plane

The three possible plane-line relationships in three dimensions. (Shown in each case is only a portion of the plane, which extends infinitely far.)

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 [edit]

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

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

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

The vector equation for a line is

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

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

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

Expanding gives

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

And solving for d {\displaystyle d} gives

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

If l n = 0 {\displaystyle \mathbf {l} \cdot \mathbf {n} =0} then the line and plane are parallel. There will be two cases: if ( p 0 l 0 ) n = 0 {\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 l n 0 {\displaystyle \mathbf {l} \cdot \mathbf {n} \neq 0} there is a single point of intersection. The value of d {\displaystyle d} can be calculated and the point of intersection, p {\displaystyle \mathbf {p} } , is given by

p = l 0 + l d {\displaystyle \mathbf {p} =\mathbf {l_{0}} +\mathbf {l} \ d} .

Parametric form [edit]

The intersection of line and plane.

A line is described by all points that are a given direction from a point. A general point on a line passing through points l a = ( x a , y a , z a ) {\displaystyle \mathbf {l} _{a}=(x_{a},y_{a},z_{a})} and l b = ( x b , y b , z b ) {\displaystyle \mathbf {l} _{b}=(x_{b},y_{b},z_{b})} can be represented as

l a + l a b t , t R , {\displaystyle \mathbf {l} _{a}+\mathbf {l} _{ab}t,\quad t\in \mathbb {R} ,}

where l a b = l b l a {\displaystyle \mathbf {l} _{ab}=\mathbf {l} _{b}-\mathbf {l} _{a}} is the vector pointing from l a {\displaystyle \mathbf {l} _{a}} to l b {\displaystyle \mathbf {l} _{b}} .

Similarly a general point on a plane determined by the triangle defined by the points p 0 = ( x 0 , y 0 , z 0 ) {\displaystyle \mathbf {p} _{0}=(x_{0},y_{0},z_{0})} , p 1 = ( x 1 , y 1 , z 1 ) {\displaystyle \mathbf {p} _{1}=(x_{1},y_{1},z_{1})} and p 2 = ( x 2 , y 2 , z 2 ) {\displaystyle \mathbf {p} _{2}=(x_{2},y_{2},z_{2})} can be represented as

p 0 + p 01 u + p 02 v , u , v R , {\displaystyle \mathbf {p} _{0}+\mathbf {p} _{01}u+\mathbf {p} _{02}v,\quad u,v\in \mathbb {R} ,}

where p 01 = p 1 p 0 {\displaystyle \mathbf {p} _{01}=\mathbf {p} _{1}-\mathbf {p} _{0}} is the vector pointing from p 0 {\displaystyle \mathbf {p} _{0}} to p 1 {\displaystyle \mathbf {p} _{1}} , and p 02 = p 2 p 0 {\displaystyle \mathbf {p} _{02}=\mathbf {p} _{2}-\mathbf {p} _{0}} is the vector pointing from p 0 {\displaystyle \mathbf {p} _{0}} to p 2 {\displaystyle \mathbf {p} _{2}} .

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:

l a + l a b t = p 0 + p 01 u + p 02 v . {\displaystyle \mathbf {l} _{a}+\mathbf {l} _{ab}t=\mathbf {p} _{0}+\mathbf {p} _{01}u+\mathbf {p} _{02}v.}

This can be rewritten as

l a p 0 = l a b t + p 01 u + p 02 v , {\displaystyle \mathbf {l} _{a}-\mathbf {p} _{0}=-\mathbf {l} _{ab}t+\mathbf {p} _{01}u+\mathbf {p} _{02}v,}

which can be expressed in matrix form as

[ l a p 0 ] = [ l a b p 01 p 02 ] [ t u v ] , {\displaystyle {\begin{bmatrix}\mathbf {l} _{a}-\mathbf {p} _{0}\end{bmatrix}}={\begin{bmatrix}-\mathbf {l} _{ab}&\mathbf {p} _{01}&\mathbf {p} _{02}\end{bmatrix}}{\begin{bmatrix}t\\u\\v\end{bmatrix}},}

where the vectors are written as column vectors.

This produces a system of linear equations which can be solved for t {\displaystyle t} , u {\displaystyle u} and v {\displaystyle v} . If the solution satisfies the condition t [ 0 , 1 ] , {\displaystyle t\in [0,1],} , then the intersection point is on the line segment between l a {\displaystyle \mathbf {l} _{a}} and l b {\displaystyle \mathbf {l} _{b}} , otherwise it is elsewhere on the line. Likewise, if the solution satisfies u , v [ 0 , 1 ] , {\displaystyle u,v\in [0,1],} , then the intersection point is in the parallelogram formed by the point p 0 {\displaystyle \mathbf {p} _{0}} and vectors p 01 {\displaystyle \mathbf {p} _{01}} and p 02 {\displaystyle \mathbf {p} _{02}} . If the solution additionally satisfies ( u + v ) 1 {\displaystyle (u+v)\leq 1} , then the intersection point lies in the triangle formed by the three points p 0 {\displaystyle \mathbf {p} _{0}} , p 1 {\displaystyle \mathbf {p} _{1}} and p 2 {\displaystyle \mathbf {p} _{2}} .

The determinant of the matrix can be calculated as

det ( [ l a b p 01 p 02 ] ) = l a b ( p 01 × p 02 ) . {\displaystyle \det({\begin{bmatrix}-\mathbf {l} _{ab}&\mathbf {p} _{01}&\mathbf {p} _{02}\end{bmatrix}})=-\mathbf {l} _{ab}\cdot (\mathbf {p} _{01}\times \mathbf {p} _{02}).}

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:

[ t u v ] = [ l a b p 01 p 02 ] 1 [ l a p 0 ] , {\displaystyle {\begin{bmatrix}t\\u\\v\end{bmatrix}}={\begin{bmatrix}-\mathbf {l} _{ab}&\mathbf {p} _{01}&\mathbf {p} _{02}\end{bmatrix}}^{-1}{\begin{bmatrix}\mathbf {l} _{a}-\mathbf {p} _{0}\end{bmatrix}},}

which expands to

[ t u v ] = 1 l a b ( p 01 × p 02 ) [ ( p 01 × p 02 ) T ( p 02 × l a b ) T ( l a b × p 01 ) T ] [ l a p 0 ] {\displaystyle {\begin{bmatrix}t\\u\\v\end{bmatrix}}={\frac {1}{-\mathbf {l} _{ab}\cdot (\mathbf {p} _{01}\times \mathbf {p} _{02})}}{\begin{bmatrix}{(\mathbf {p} _{01}\times \mathbf {p} _{02})}^{\mathrm {T} }\\{(\mathbf {p} _{02}\times -\mathbf {l} _{ab})}^{\mathrm {T} }\\{(-\mathbf {l} _{ab}\times \mathbf {p} _{01})}^{\mathrm {T} }\end{bmatrix}}{\begin{bmatrix}\mathbf {l} _{a}-\mathbf {p} _{0}\end{bmatrix}}}

and then to

[ t u v ] = 1 l a b ( p 01 × p 02 ) [ ( p 01 × p 02 ) ( l a p 0 ) ( p 02 × l a b ) ( l a p 0 ) ( l a b × p 01 ) ( l a p 0 ) ] , {\displaystyle {\begin{bmatrix}t\\u\\v\end{bmatrix}}={\frac {1}{-\mathbf {l} _{ab}\cdot (\mathbf {p} _{01}\times \mathbf {p} _{02})}}{\begin{bmatrix}{(\mathbf {p} _{01}\times \mathbf {p} _{02})}\cdot (\mathbf {l} _{a}-\mathbf {p} _{0})\\{(\mathbf {p} _{02}\times -\mathbf {l} _{ab})}\cdot (\mathbf {l} _{a}-\mathbf {p} _{0})\\{(-\mathbf {l} _{ab}\times \mathbf {p} _{01})}\cdot (\mathbf {l} _{a}-\mathbf {p} _{0})\end{bmatrix}},}

thus giving the solutions:

t = ( p 01 × p 02 ) ( l a p 0 ) l a b ( p 01 × p 02 ) {\displaystyle t={\frac {{(\mathbf {p} _{01}\times \mathbf {p} _{02})}\cdot (\mathbf {l} _{a}-\mathbf {p} _{0})}{-\mathbf {l} _{ab}\cdot (\mathbf {p} _{01}\times \mathbf {p} _{02})}}}
u = ( p 02 × l a b ) ( l a p 0 ) l a b ( p 01 × p 02 ) {\displaystyle u={\frac {{(\mathbf {p} _{02}\times -\mathbf {l} _{ab})}\cdot (\mathbf {l} _{a}-\mathbf {p} _{0})}{-\mathbf {l} _{ab}\cdot (\mathbf {p} _{01}\times \mathbf {p} _{02})}}}
v = ( l a b × p 01 ) ( l a p 0 ) l a b ( p 01 × p 02 ) . {\displaystyle v={\frac {{(-\mathbf {l} _{ab}\times \mathbf {p} _{01})}\cdot (\mathbf {l} _{a}-\mathbf {p} _{0})}{-\mathbf {l} _{ab}\cdot (\mathbf {p} _{01}\times \mathbf {p} _{02})}}.}

The point of intersection is then equal to

l a + l a b t {\displaystyle \mathbf {l} _{a}+\mathbf {l} _{ab}t}

Uses [edit]

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 [edit]

  • Plücker coordinates#Plane-line meet calculating the intersection when the line is expressed by Plücker coordinates.
  • Plane–plane intersection

External links [edit]

  • Intersections of Lines, Segments and Planes (2D & 3D) from GeomAlgorithms.com

Where Does the Line Through Two Points Intersect a Plane

Source: https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection