My Math Forum  

Go Back   My Math Forum > High School Math Forum > Algebra

Algebra Pre-Algebra and Basic Algebra Math Forum


Reply
 
LinkBack Thread Tools Display Modes
February 6th, 2011, 03:54 AM   #1
Newbie
 
Joined: Feb 2011

Posts: 1
Thanks: 0

Line segments-distance

How can I calculate the shortest distance between two line segments? if they are skew?
line1:A[x1,y1,z1],B[x2,y2,z2]
line2:C[x1,y1,z1],D[x2,y2,z2]
andoxx is offline  
 
February 6th, 2011, 08:23 AM   #2
Senior Member
 
Joined: Nov 2010

Posts: 502
Thanks: 0

Re: Line segments-distance

A key thing to note is that this segment will be perpendicular to both.
DLowry is offline  
February 6th, 2011, 10:56 AM   #3
Senior Member
 
Joined: Feb 2009
From: Adelaide, Australia

Posts: 1,519
Thanks: 3

Re: Line segments-distance

This is a difficult task, best left to a math library, and I'll direct you to this algorithm.

Quote:
A key thing to note is that this segment will be perpendicular to both.
Not necessarily, which is the problem.
aswoods is offline  
February 6th, 2011, 01:24 PM   #4
Senior Member
 
Joined: Nov 2010

Posts: 502
Thanks: 0

Re: Line segments-distance

Quote:
Originally Posted by aswoods
This is a difficult task, best left to a math library, and I'll direct you to this algorithm.

Quote:
A key thing to note is that this segment will be perpendicular to both.
Not necessarily, which is the problem.
I challenge you to find me an example. Not an angry challenge - just that I am somewhat confident. To motivate my argument, I will note that by taking the cross product of the directions of the two lines, we can find a particular plane. And by placing one copy of this plane on one line, and another on the other line, we have two parallel planes. Finally, by finding the distances between the two planes (which is more standard, I believe), we will see a perpendicular from one line to the other - and by the triangle inequality, any non-perpendicular will be longer.
DLowry is offline  
February 6th, 2011, 01:25 PM   #5
Senior Member
 
Joined: Nov 2010

Posts: 502
Thanks: 0

Re: Line segments-distance

In addition, I direct you to the following links - which give simple ways to accomplish this (different than the one I proposed, however, but confirming the mutual perpendicular).

http://www.coventry.ac.uk/ec//jtm/slides/8/sld8p5.pdf
http://members.tripod.com/Paul_Kirby/vector/Vclose.html
DLowry is offline  
February 6th, 2011, 01:33 PM   #6
Global Moderator
 
Joined: May 2007

Posts: 6,306
Thanks: 525

Re: Line segments-distance

Point P(s) on line 1, P(s)= A + (B-A)s
Point Q(t) on line 2, Q(t)= C + (D-C)t

Let f(s,t) = |P(s)-Q(t)|^2
Compute ?f/?s and ?f/?t and set them both = 0. Solve the simultaneous equations for s and t.

(Notation: cap. letters for vectors, lower vase for scalars.)
mathman is offline  
February 6th, 2011, 02:56 PM   #7
Senior Member
 
Joined: Feb 2009
From: Adelaide, Australia

Posts: 1,519
Thanks: 3

Re: Line segments-distance

Quote:
Originally Posted by DLowry
I challenge you to find me an example. Not an angry challenge - just that I am somewhat confident.
It's about segments not lines. If the first segment is (0,0,0)-(0,0,1), and the second segment is (0,0,2)-(0,0,3), then the shortest distance between the segments is 1, and the joining segment is (0,0,1)-(0,0,2). In this example, the two segments are on the same line, but it is not necessary for the problem to arise, even in 2D.
aswoods is offline  
February 8th, 2011, 08:09 PM   #8
Senior Member
 
Joined: Nov 2010

Posts: 502
Thanks: 0

Re: Line segments-distance

Quote:
Originally Posted by aswoods
Quote:
Originally Posted by DLowry
I challenge you to find me an example. Not an angry challenge - just that I am somewhat confident.
It's about segments not lines. If the first segment is (0,0,0)-(0,0,1), and the second segment is (0,0,2)-(0,0,3), then the shortest distance between the segments is 1, and the joining segment is (0,0,1)-(0,0,2). In this example, the two segments are on the same line, but it is not necessary for the problem to arise, even in 2D.
Aha - I yield defeat. I hadn't considered this.
DLowry is offline  
Reply

  My Math Forum > High School Math Forum > Algebra

Tags
line, segmentsdistance



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
divide ellipse into line segments with required accura nilesh33 Algebra 0 February 20th, 2013 10:17 AM
Making a Circle out of line segments Jmlee19 Calculus 5 December 6th, 2012 02:23 PM
Geometry piecewise line segments master555 Applied Math 0 December 2nd, 2011 05:56 PM
Find the center of overlap between two line segments 1101 Algebra 4 February 22nd, 2011 11:43 AM
Overlap of line segments Cheesy74 Algebra 4 November 17th, 2009 05:23 AM





Copyright © 2017 My Math Forum. All rights reserved.