Normalized Plane
(Unit Normal Vector)
Non-normalized Plane
Ax + By + Cz + D = 0

N = Ai + Bj + Ck

Distance d from a point P to the plane
d = | N · P + D |
d2 =
( N · P + D ) ( N · P + D )

N · N
 
d =
| N · P + D |

|N|
Closest point P' on the plane to a point P
P' = P - ( N · P + D ) N
P' = P -
( N · P + D ) N

N · N
Intersection of the line L(t) = B + t M with the plane
t = -
N · B + D

N · M
Projection V' of a vector V onto the plane.
(Subtract from the vector its projection onto the normal.)
V' = V - (N · VN
V' = V -
(N · VN

N · N
The line L(t) = B + t M of intersection between planes N1, D1 and N2, D2
det = ( N1 · N2 ) ( N1 · N2 ) - ( N1 · N1 ) ( N2 · N2 )

Note: N1 || N2 => det = 0

s1 =
( N2 · N2 ) D1 - ( N1 · N2 ) D2

det
 
s2 =
( N1 · N1 ) D2 - ( N1 · N2 ) D1

det

M = N1 × N2

B = s1N1 + s2N2

Line
L(t) = B + tM
Closest point on the line from a point P
t =
M · ( P - B )

M · M
Closest point on line L1(t) to line L2(u)
N = M2 × ( M2 × M1 )

D = - ( N · B2 )

t = -
N · B1 + D

N · M1