Distance between two 3D lines

204 Views Asked by At

What is the distance between the 3D lines $x = \begin{pmatrix} 1 \\ 2 \\ -4 \end{pmatrix} + \begin{pmatrix} -1 \\ 3 \\ -1 \end{pmatrix} t$ and $y = \begin{pmatrix} 0 \\ 3 \\ 5 \end{pmatrix} + \begin{pmatrix} 1 \\ 4 \\ 3 \end{pmatrix} u.$

Hint: To find the distance, try to calculate $AB$'s smallest possible value, where $A$ represents a point which lies on one line and $B$ represents a point which lies on the other line.

I remember a handy formula here: http://math.harvard.edu/~ytzeng/worksheet/distance.pdf that allows mathematicians to find the distance between 3D lines, but I would rather solve the problem given the method that was hinted.

I'm not entirely sure how to solve it this way, however. Would I try to find a value for both $t$ and $u$ that makes lines $x$ and $y$ the smallest value? I don't know if I'm thinking of solving this problem correctly.

Thanks.

2

There are 2 best solutions below

5
On

Yes, to derive this, the natural approach would be to consider the function $$ F(t,u) = |x(t)-y(u)| $$ If you plug the definition of $x(t)$ and $y(u)$ into the distance formula and simplify a bit, you get $F(t,u) = \sqrt{P(t,u)}$ where $P$ is some quadratic polynomial in two variables. The minimum of $F$ occurs at the same $(t,u)$ as the minimum of $P$, which should be easy to find using calculus. Then plug the $(t,u)$ you find back into the expression you got for $F$.

0
On

If you have access to a computational 3D geometry system, here is a fairly straightforward solution. Let's call the two skew lines L1 and L2.

  1. Start by visualizing the closest-approach "bridge" Line Segment BR. The run direction of BR (as a unit vector) can be obtained by computing the normalized cross-product of the L1 and L2's run directions:

    BR_dir =  normalize( L1_dir x L2_dir)
    

2a. Extrude L1 into a plane PL1 in the extrusion direction BR_dir.

2b. Extrude L2 into a plane PL2 in the extrusion direction BR_dir.

  1. The bridging line segment's endpoints are intersections of plane + line:

    BR_endPt1 = intersection (L1, PL2)

    BR_endPt2 = intersection (L2, PL1)

  2. The distance between L1 and L2 at closest approach is the length of BR, easily computed from its endpoints.

This same algorithm (bridging line segment of two skew lines) can also serve to find the intersection of two coplanar lines in 3D. In that case, the bridging line segment consists of two identical points, which solve for the intersection of the two lines.

Because of finite precision in algorithmic geometry, it is actually very hard to create two exactly coplanar lines (even when they share a common point). Because of numerical error, they effectively become skew lines that approach very closely. For that reason, the bridging line segment algorithm is more practical than one that assumes coplanar lines meet up perfectly (which would require infinite precision real numbers in the representations).