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).

Multiply the two vectors by cross to obtain their common perpendicular vector N=(x,y,z), select points A and B (arbitrary) on the two lines respectively, and obtain 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 scalar product of two vectors, the following is the modulus), let the intersection points be C and D, and substitute them into the symmetric formula of the common perpendicular line N. Since the two points C and D satisfy the initial straight line equation, we get two continuous equations about C (or D), and we can solve them separately.

Formula: