Distance between skew lines
Unlike the distance between parallel lines, the distance between skew lines can be traced back to the Hesse normal form.
Given are two skew lines:
We calculate an orthogonal normal vector from the two direction vectors.
This is normalized (unit normal vector) and inserted into the Hesse normal form together with the two support vectors $\vec{p}$ and $\vec{q}$. The distance $d$ is then obtained.
Method
- Calculate normal vector
- Variant 1: Use scalar product
- Variant 2: Use cross product
- Form unit normal vector
- Insert points in Hesse normal form
Example
Two skew lines are given
$\text{g: } \vec{x} = \begin{pmatrix} 1 \\ 1 \\4 \end{pmatrix} + r \cdot \begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}$
$\text{h: } \vec{x} = \begin{pmatrix} 3 \\ 4 \\ 0 \end{pmatrix} + r \cdot \begin{pmatrix} 1 \\ 5 \\ 2 \end{pmatrix}$
-
Calculate normal vector
Variant 1
Since both direction vectors are perpendicular to the normal vector $\vec{n}=\begin{pmatrix} x \\ y \\ z \end{pmatrix}$, the scalar product must result in zero.
- $\begin{pmatrix} x \\ y \\ z \end{pmatrix}\cdot\color{blue}{\begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}} = 0$
- $\begin{pmatrix} x \\ y \\ z \end{pmatrix}\cdot\color{blue}{\begin{pmatrix} 1 \\ 5 \\ 2 \end{pmatrix}} = 0$
The scalar product can now be calculated.
- $1x+1y=0$
- $1x+5y+2z= 0$
II.-I.
$4y+2z=0$
Choose $z$ freely, e.g. $z=4$
$4y+8=0\quad|-8$
$4y=-8\quad|:4$
$y=-2$Calculate $x$ with I. (insert $y$)
$x+y=0$
$x-2=0\quad|+2$
$x=2$$\vec{n}=\begin{pmatrix} 2 \\ -2 \\ 4 \end{pmatrix}$
Variant 2
In variant 2, only the cross product of the two vectors is formed instead.
$\vec{n}$ $=\color{blue}{\begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}} \times \color{blue}{\begin{pmatrix} 1 \\ 5 \\ 2 \end{pmatrix}}$ $=\begin{pmatrix} 1\cdot2 - 0\cdot5 \\ 0\cdot1 - 1\cdot2 \\ 1\cdot5 - 1\cdot1 \end{pmatrix}$ $=\begin{pmatrix} 2 \\ -2 \\ 4 \end{pmatrix}$ -
Unit normal vector
The normal vector is normalized by dividing by the magnitude of the vector.
$\vec{n}=\begin{pmatrix} 2 \\ -2 \\ 4 \end{pmatrix}$
$|\vec{n}|=\sqrt{2^2+(-2)^2+4^2}$ $=\sqrt{24}$
$\vec{n_0}= \frac{\vec{n}}{|\vec{n}|}$ $=\begin{pmatrix} 2/\sqrt{24} \\ -2/\sqrt{24} \\ 4/\sqrt{24} \end{pmatrix}$
-
Insert points
$d=$ $\left|\left(\begin{pmatrix}1 \\ 1 \\4 \end{pmatrix} - \begin{pmatrix} 3 \\ 4 \\ 0\end{pmatrix}\right) \cdot \begin{pmatrix} 2/\sqrt{24} \\ -2/\sqrt{24} \\ 4/\sqrt{24} \end{pmatrix} \right|$ $=\left|\begin{pmatrix} -2 \\ -3 \\ 4 \end{pmatrix} \cdot \begin{pmatrix} 2/\sqrt{24} \\ -2/\sqrt{24} \\ 4/\sqrt{24} \end{pmatrix} \right|$ $\approx3.67$