Distance from point to plane
Here’s a quick sketch of how to calculate the distance from a point P = (x1,y1,z1) to a plane determined by normal vector N = (A,B,C) and point Q = (x0,y0,z0).
The equation for this plane is A(x-x0) + B(y -y0) + C(z -z0) = 0. (Or we might write the equation as Ax + By + Cz + D = 0, where D = -Ax0 -By0 -Cz0.) In the below CVT, I’ve drawn P in red and Q in yellow. To simplify the figure, I’ve fixed the plane. Although you can move Q around, it is confined to lie in the plane.
To calculate the distance from point P to the plane, I’ve dropped a perpendicular from the point P to the plane, drawing it as a gray line. The point R where the perpendicular hits the plane is drawn in green. R is the point on the plane closest to P. Hence the distance from P to the plane is the distance from P to R, or the length of the gray line. (You cannot move R directly by dragging on it, as its position is determined by P. It will move as you move P.)
Next, we calculate an expression for a unit normal vector, i.e., a normal vector of length one. It is simply N divided by its length. We’ll use the notation n for the unit normal vector:
n = = . |
Let v be the vector from Q to P (shown in blue). Since P = (x1,y1,z1) and Q = (x0,y0,z0), we calculate that v = (x1 -x0,y1 -y0,z1 -z0). The length of the gray line, i.e., the distance from P to the plane, is simply the length of the projection of v onto the unit normal vector n. Since n is length one, this distance is simply the absolute value of v ⋅ n. We’ll label the distance d; it is
| d | = |v ⋅ n| | ||
| = |(x1 - x0,y1 - y0,z1 - z0) ⋅ n| | |||
= . | (1) |
Recall that we can also write the equation for the plane as Ax + By + Cz + D = 0, with D = -Ax0 -By0 -Cz0. We’ll substitute into the above formula, to arrive at the following expression for the distance from P = (x1,y1,z1) to the plane Ax + By + Cz + D = 0:
d = . | (2) |
= 

