2D Distance between 3D line segments

  • Thread starter Thread starter ScottB
  • Start date Start date
  • Tags Tags
    2d 3d Line
Click For Summary

Homework Help Overview

The discussion revolves around calculating the distance between two line segments in a three-dimensional space where the x and y dimensions represent spatial coordinates and the z dimension represents time. The original poster is seeking a method to measure this distance while considering only the spatial components, leading to a complex formulation involving calculus and linear algebra.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning, Assumption checking

Approaches and Questions Raised

  • The original poster attempts to derive a solution using calculus and expresses uncertainty about transforming the problem into a more manageable form. They also explore the possibility of using linear algebra and matrix operations to minimize the distance between the functions representing the line segments.
  • Some participants suggest considering existing distance metrics and transformations, while others inquire about the implications of projecting the problem onto a 2D plane.
  • Questions arise regarding the appropriateness of seeking help from mathematics professors and the potential for impoliteness in doing so.

Discussion Status

The discussion is ongoing, with participants providing insights and suggestions related to the mathematical concepts involved. There is a recognition of the original poster's challenges in vocabulary and understanding, and some guidance has been offered regarding the use of projections and distance metrics. However, no consensus has been reached on a specific method or solution.

Contextual Notes

The original poster notes that this problem is not a traditional homework assignment but rather a challenge encountered in their research. They express a lack of comfort with the necessary mathematical vocabulary and concepts, which may be impacting their ability to progress.

ScottB
Messages
4
Reaction score
0
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 post-calc 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.

Homework Statement



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).

Homework 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.

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 / matrix-related solution to my problem.

In my pursuit of this I have formulated the problem as follows:

I start with four points in 3-space:
(Fx(t0), Fy(t0), t0),
(Fx(t2), Fy(t2), t2),
(Gx(t1), Gy(t1), t1),
(Gx(t3), Gy(t3), t3),

where

t0 <= t1 < t2 <= t3

and

Fx(t) = Afx t + Bfx for t in (t0, t2)
Fy(t) = Afy t + Bfy for t in (t0, t2)
Gx(t) = Agx t + Bgx for t in (t1, t3)
Gy(t) = Agy t + Bgy for t in (t1, t3)

where Afx, Bfx, Afy, Bfy, Agx, Bgx, Agy and Bgy are constants.

Minimize ( (Fx(t) - Gx(t))2 + (Fy(t) - Gy(t))2 )0.5 over t in (t1, t2)

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
 
Last edited:
Physics news on Phys.org
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 3-space 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.
 
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!
 
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.
 
Haha, that's great. It's funny what will get you through, isn't it?
 
ScottB said:
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 3-space 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.
If y is an nx1 vector and X is a nxk matrix, then bX(y) = (X'X)-1X'y is the projection of y to the vector space spanned by X. If for two 3D functions f = (f1, f2, f3) and g = (g1, g2, g3) of time t, you define z(t) = |f(t) - g(t)|, then bX(z(t)) will give you the projection of the difference between f and g at a given t, which you then can minimize with respect to t. Alternatively, you can minimize |bX(f(t)) - bX(g(t))| with respect to t, which is the distance between the two projections.
 
EnumaElish said:
If y is an nx1 vector and X is a nxk matrix, then bX(y) = (X'X)-1X'y is the projection of y to the vector space spanned by X. If for two 3D functions f = (f1, f2, f3) and g = (g1, g2, g3) of time t, you define z(t) = |f(t) - g(t)|, then bX(z(t)) will give you the projection of the difference between f and g at a given t, which you then can minimize with respect to t. Alternatively, you can minimize |bX(f(t)) - bX(g(t))| with respect to t, which is the distance between the two projections.
I would definitely have logged in as EnumaElish had PF administration awarded that account the privilege of posting replies, after I reset my e-mail address yesterday (Tuesday). The projection formula in the previous post should have been bX(y) = X(X'X)-1X'y.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 64 ·
3
Replies
64
Views
14K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 4 ·
Replies
4
Views
18K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
Replies
4
Views
3K