Shortest distance between skew lines (source code)

= Shortest distance between skew lines
{title2=$d=|\Delta a\cdot(m_1\times m_2)|/|m_1\times m_2|$}

For lines $a_1+t m_1$ and $a_2+u m_2$ with nonparallel direction vectors, their shortest separation is the absolute <orthogonal projection> of $a_2-a_1$ onto their common normal $m_1\times m_2$. Components in the span of $m_1,m_2$ can be cancelled by choosing $t,u$, while the normal component cannot. The same formula gives zero for intersecting nonparallel lines. Parallel lines instead have separation $|(a_2-a_1)\times m_1|/|m_1|$.