Distance Between Two Lines
Calculates the shortest distance between two lines in space.
A line passing through the point (a, b, c) and parallel to the vector (p, q, r) is
| \(\hspace{20px}\frac{x-a}{p}=\frac{y-b}{q}=\frac{z-c}{r}\) |

| Shortest Distance d |
The cross product of the direction vectors of 2 lines is perpendicular to both lines.
The absolute value of the dot product of the unit vector in this direction with a vector connecting any point on one line to any point on the other gives the shortest distance between the 2 lines.
The absolute value of the dot product of the unit vector in this direction with a vector connecting any point on one line to any point on the other gives the shortest distance between the 2 lines.
| \( \normalsize The\ shortest\ distance\ between\ two\ lines\\ (1)\ d=\left|\frac{(\vec{V_1}\times \vec{V_2})\cdot\vec{P_1P_2}}{\left|\vec{V_1}\times \vec{V_2}\right|}\right|,\hspace{30px}at\ \left|\vec{V_1}\times \vec{V_2}\right|\ne0\\ \hspace{10px} =\left|{\large \frac{(q_1r_2-q_2r_1)a_{12}+(r_1p_2-r_2p_1)b_{12}+(p_1q_2-p_2q_1)c_{12}} {\sqrt{(q_1r_2-q_2r_1)^2+(r_1p_2-r_2p_1)^2+(p_1q_2-p_2q_1)^2}}}\right|\\ (2)\ d= \frac{\left|\vec{V_1}\times \vec{P_1P_2}\right|}{\left|\vec{V_1}\right|},\hspace{30px}at\ \left|\vec{V_1}\times \vec{V_2}\right|=0\\ \hspace{10px}={\large \frac{\sqrt{(b_{12}r_1{\tiny-}c_{12}q_1)^2{\tiny+}(c_{12}p_1{\tiny-}a_{12}r_1)^2{\tiny+}(a_{12}q_1{\tiny-}b_{12}p_1)^2}}{\sqrt{p_1^2+q_1^2+r_1^2}}}\\ \hspace{20px} a_{12}=a_1{\tiny-}a_2,\hspace{20px} b_{12}=b_1{\tiny-}b_2,\hspace{20px} c_{12}=c_1{\tiny-}c_2\\ \) |
No customer feedback for this calculation yet.