Shortest distance

Given a point A and a line `vec r = vec r_0 + tvec m`, we can find the shortest distance from the point to the line easily with

`d = (|vec(AB) xx vec m|)/(|vec m|)`.

Given two parallel planes with a normal vector `vec n` (it doesn’t matter which plane you take it from) and containing points A and B, we can find the shortest distance between them using the scalar projection:

`d = |vec(AB)_n| = |vec(AB) * hat n| = (|vec(AB) * vec n|)/(|vec n|)`.

(Note that nonparallel planes intersect, so the shortest distance is zero.) We can also use this equation for skew lines, where one line contains A and the other has B. We calculate `vec n` by crossing their direction vectors:

`vec n = vec m_1 xx vec m_2`.