Distance between two 3D lines
Parametric line equation L1: x = + t
y = + t
z = + t
L2: x = + s
y = + s
z = + s
Line equation L1: x +
= y +
= z +
L2: x +
= y +
= z +
Lines defined
by 4 points
L1: x1 y1 z1
x2 y2 z2
L2: x3 y3 z3
x4 y4 z4
Distance between the lines:
 
Connecting line intersections:
 
Angle between the lines:
 
Connecting line vector:
 
Connecting line unit vector: