Shortest distance between two lines calculator

The straight line passes through A(a1,b1,c1) and is parallel to the vector V1(p1,q1,r1)
Point A(,,)
Vector V1(,,)
The straight line passes through B(a2,b2,c2) and is parallel to the vector V2(p2,q2,r2)
Point B(,,)
Vector V2(,,)
The shortest distance between two straight lines (d)

First, transform the equation of the line into a symmetrical form to obtain its direction vector n1=(a1,b1,c1),n2=(a2,b2,c2).

Cross-product the two vectors to get their common perpendicular vector N = (x, y, z), select points A and B (arbitrary) on the two lines respectively, and get vector AB. The projection of vector AB in the direction of vector N is the distance between the two non-coplanar lines (that is, the shortest distance). Do you know how to calculate it?

d=|vector N*vector AB|/|vector N| (the above is the dot product of two vectors, the following is the modulus), let the intersection points be C and D, substitute them into the symmetry formula of the common perpendicular line N, and because the two points C and D satisfy the initial straight line equation respectively, we get two consecutive equations about C (or D), just solve them separately

formula: