shortest distance between two straight 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, convert the straight line equation into a symmetrical formula and obtain its direction vector n1=(a1,b1,c1),n2=(a2,b2,c2).

cross-multiply the two vectors to obtain their common vertical vector n = (x, y, z). select points a and b (arbitrary) on the two straight lines to obtain the vector ab. find the projection of the vector ab in the direction of the vector n, which is two the distance between straight lines on opposite sides (the shortest distance), do you know how to find it?

d=|vector n*vector ab|/|vector n| (the above is the quantitative product of the two vectors, the following is the modulus), let the intersection points be c, d, and bring them into the symmetry of the common perpendicular n, and because c , the two points d respectively satisfy the linear equation at the beginning, so we get two consecutive equations about c (or d) and solve them separately.

formula: