Find the shortest distance between 2 non-paralle lines (skew lines) in 3-space

1. Feb 4, 2004

yanyin

explain how you go about finding the shortest distance between 2 non-parallel lines (i.e. skew lines).
for example:
x=3-2t, y=1-4t, z = t and (x+2)/3=y+1=(z+1)/-2

2. Feb 4, 2004

mathman

You can work out the details.

1. Take the cross product of the two lines.

2. Construct a plane perpendicular to this vector.

3. Project the two original lines onto this plane.

4. Find the point of intersection of the two projections.

5. Find the points on the original two lines which projected onto the intersection point.

6. Find the distance between these points. That's what you are looking for.

3. Feb 4, 2004

mathman

Since this is the calculus forum, here is an alternate approach to my previous note.

1. Represent both lines in parameter form (s and t).

2. Set up the distance squared (H) between arbitrary points p on line 1 and q on line 2 as a function of the two parameters.

3, Take partial derivatives of H with respect to t and with respect to s. This will be two linear equations in two unknowns s and t.

4. Solve for s and t. Find the points on the 2 lines corresponding to these values of s and t and compute the distance between them.

5. If you are not interested in the points on the lines but only the distance, plug the found values of s and t into the equation for H and take a square root.

4. Feb 4, 2004

yanyin

i found a very simple, basic and easy to understand solution on the web, take a look if you like:
http://www.mis.coventry.ac.uk/jtm/slides/8/sld8p5.pdf [Broken]

Last edited by a moderator: May 1, 2017
5. Oct 7, 2007

pbierre

I like this approach for its simplicity and symmetry:
1. Normalize-Cross-Prod the directions of L1 and L2 to obtain the direction of their adjoining lineSeg dL
2. Extrude L1 along direction dL (= plane PL1)
3. Extrude L2 along direction dL (= plane PL2)
4. The endpoints of the shortest LineSeg bridging between L1 and L2 are:
intersection( PL1 , L2 )
intersection( PL2 , L1 )

from Pierre Bierre, author, "Flexing the Power of Algorithmic Geometry"