When a line meets a plane
20 April, 2019Readtime: 4 mins
This was always a nice problem to solve involving vectors and linear algebra. Given two points dictating the line and three points defining the plane, at what point (if any) does the line intersect the plane?
First, let’s go through the vector equation of a line. I’ve drawn out a sketch involving the points and and the vectors they create with respect to the origin and respectively.
The point is then a general point on the line, which is parameterised by the scalar quantity .
A sketch showing the vector equation of a line defined by the points and . A general point on the line, r, can then be determined from the 2 vectors that the points make with the origin.
From examination of this sketch it is then clear that our vector equation of the line, or put another way, the vector which points from the origin to the general point on the line , is then .
Here is unknown and if it is such that , then it lies between the points, otherwise it lies on the line outside of these points.
Now for the plane. This may look slightly more complicated from the sketch but in reality it is not much different. We require three points to define a plane, since now we have an extra degree of freedom. I’ve labelled these 3 points as . The vectors , then define these points with respect to the origin. The vector defines the normal vector to the plane, such that . Now, the point is then a general point on the plane, which is parameterised by the scalar quantities and .
A sketch showing the vector equation of a plane defined by the points , , and .
Thus, we can write the vector from the origin to the general point in the plane as
For the intersection we must equate the two vector equations for a general point in the line and in the plane.
or as,
Since we know the points we can then solve for the parameters by writing it in the form
Which then is in the form of , where is the vector containing the 3 unknown parameters and is the matrix which we will need to invert, in order to solve the system of equations. However, in the case the matrix is singular, that is, it has no inverse, it tells us that the line and the plane do not interact. Either the line lies in the plane or it is parallel to the plane but does not lie in the plane. For this example let’s assume it does intersect and therefore have an inverse, we then have .
Once we have computed the inverse we only need to know the parameter to compute the interaction point by putting it back into our line equation. Thus our intersection point is,
A quick python script I made some time ago aims to tackle this. It can be found here.
Written by Thomas Stainer who likes to develop software for applications mainly in maths and physics, but also to solve everyday problems. Check out my GitHub page here.