2D Distance between 3D line segmentsby ScottB Tags: distance, geometry, line segment, linear algebra, minimization 

#1
Oct2008, 01:40 AM

P: 4

0. Background
I am a Doctoral student studying Geographic Information Science. I do a good bit of programming during the course of my work. Recently, I happened upon a problem which I cannot solve on my own (my postcalc math comfort zone is mostly in procedure and repetition, not in formulating new approaches to unseen problems; also, I've forgotten important bits of it). This problem arose as I was working on a statistical analysis package for spatial data. I am a first time reader and poster, and apologize in advance for any faux pas I may commit out of ignorance. 1. The problem statement, all variables and given/known data The statistical software component I am developing needs to calculate the distance between two line segments. Not the absolute distance, as that is trivial. In these data, the x and y dimensions represent space and the z dimension is time (t). The distance must be in terms of space, not of time, meaning that for any point (x,y,t) on the first line distance can only be measured to a single point (x2,y2,t) on the second line (obviously where t=t). 2. Relevant equations None given that I didn't derive myself; as I mentioned, this is not a homework problem per say, but rather a problem encountered in the course of separate research. 3. The attempt at a solution I've taken enough calculus to know that there lies a solution therein. I can, in theory, derive two parabolas on a 2d plane whose distance corresponds to the distance between the two line segments, and then break out a little calculus and solve it. There are two problems with this approach. First, I don't know how to form a translation that will stretch a curved plane (between two skew lines, i think its what they're called) and flatten it while maintaining its properties (thereby translating the two straight line segments into parabolas). I don't even have the correct math vocabulary to explain that understandably. Second, calculus rarely translates well into a computing environment, so that's a dead end I fear. I'm hoping there is a linear algebra / matrixrelated solution to my problem. In my pursuit of this I have formulated the problem as follows: I start with four points in 3space: (F_{x}(t_{0}), F_{y}(t_{0}), t_{0}), (F_{x}(t_{2}), F_{y}(t_{2}), t_{2}), (G_{x}(t_{1}), G_{y}(t_{1}), t_{1}), (G_{x}(t_{3}), G_{y}(t_{3}), t_{3}), where t0 <= t_{1} < t_{2} <= t_{3} and F_{x}(t) = A_{fx} t + B_{fx} for t in (t_{0}, t_{2}) F_{y}(t) = A_{fy} t + B_{fy} for t in (t_{0}, t_{2}) G_{x}(t) = A_{gx} t + B_{gx} for t in (t_{1}, t_{3}) G_{y}(t) = A_{gy} t + B_{gy} for t in (t_{1}, t_{3}) where A_{fx}, B_{fx}, A_{fy}, B_{fy}, A_{gx}, B_{gx}, A_{gy} and B_{gy} are constants. Minimize ( (F_{x}(t)  G_{x}(t))^{2} + (F_{y}(t)  G_{y}(t))^{2} )^{0.5} over t in (t_{1}, t_{2}) To explain this, I have 'projected' the two line segments onto the x,t and y,t planes, and derived a general expression for each as a function of t. But now that I have my fancy formulation, I haven't the faintest idea where to go from here. Even a keyword would help me, as I am (obviously) deficient in appropriate math vocabulary. Anyway, I greatly appreciate any help or suggestions I can get; thanks in advance!  Scott 



#2
Oct2008, 08:43 AM

Sci Advisor
HW Helper
P: 2,483

You have defined a distance between two functions of time. Or, you can look at it as a distance between two Graphs (sets of points) on the Cartesian plane. Some useful keywords:
Distance (esp. http://en.wikipedia.org/wiki/Distanc...oint_and_a_set) Metric Metric space 



#3
Oct2008, 10:14 AM

P: 4

Hey, thanks for the insight! Yes, I didn't recall the mathematical use of the term 'metric'. That lead me to existing distance metrics, though as was expected none of these were what I was looking for exactly. So I need a method to evaluate the distance between two (really four?) functions of time.
I did consider distance between graphs on the Cartesian plane, but I have no idea how to make a transformation/translation from the 3space I have onto a plane while preserving my distance metric. Could you (or anybody) point me to something about distance or minimization of functions using matrix operations? I believe my ignorance here is the central culprit of my dilemma. If I can express the 'minimize' portion of my formulation more concretely, I can code it out. Thanks! I really do appreciate the help. 



#4
Oct2208, 11:29 AM

P: 4

2D Distance between 3D line segments
Does anyone know if it would be impolite to knock on a random math professor's door during his or her office hours, introduce myself and ask them for help on this? I feel that taking my research problems to strangers is a bit impudent, but I am running out of sources of help.
Thanks! 



#5
Oct2208, 11:38 AM

Sci Advisor
HW Helper
P: 8,961

Not at all, nobody ever talks to maths professors so they would probably be delighted to see you!
I got through a physics PhD knowing almost no maths by simply knowing a lot of maths / theoretical physics profs and being the onyl one in the dept who could fix their computers. 



#6
Oct2208, 11:42 AM

P: 4

Haha, that's great. It's funny what will get you through, isn't it?




#7
Oct2508, 02:48 PM

Sci Advisor
HW Helper
P: 2,483





#8
Oct3008, 12:23 AM

P: 81




Register to reply 
Related Discussions  
Distance of a point from a line (3D)  Calculus & Beyond Homework  8  
point line and the distance  Calculus & Beyond Homework  2  
on open set on the line can be written as countable union of disjoint segments  Calculus  10  
triangle with concurrent parallel line segments  General Math  1  
distance from point to line  Precalculus Mathematics Homework  3 