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 \mathbf{p} for which

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

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

The vector equation for a line is

\mathbf{p} = d\mathbf{l} + \mathbf{l_0} \quad    d\in\mathbb{R}

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

(d \mathbf{l} + \mathbf{l_0} - \mathbf{p_0})\cdot\mathbf{n} = 0.

Expanding gives

d \mathbf{l}\cdot\mathbf{n} + (\mathbf{l_0}-\mathbf{p_0})\cdot\mathbf{n} = 0.

And solving for d gives

d = {(\mathbf{p_0}-\mathbf{l_0})\cdot\mathbf{n} \over \mathbf{l}\cdot\mathbf{n}}.

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

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

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

where \mathbf{l}_a=(x_a, y_a, z_a) and \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

\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 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:

\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

\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:

 \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{l}_a + (\mathbf{l}_b - \mathbf{l}_a)t

If the line is parallel to the plane then the vectors \mathbf{l}_b - \mathbf{l}_a, \mathbf{p}_1-\mathbf{p}_0, and \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 t \in [0,1],, then the intersection point is on the line between \mathbf{l}_a and \mathbf{l}_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 solved by inverting the matrix:

 \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.

See also

External links

This article is issued from Wikipedia - version of the Wednesday, December 30, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.