Shortest distance between two line segments in 3D with symbolic equations?
7 views (last 30 days)
Show older comments
Hi! I am new to MatLab and therefor not well known with the program and the commands and such.
I see several posts here that answer my problem, if my problem would have had fixed points. But how can I calculate the shortest distance between two line segments when my points are not fixed? They are variable. I have lines that can move independently and are tasked with making sure they dont come closer than a given distance of each other.
For each of my X and Y and Z i have LONG equations with up to 8 variables (sin(k1)*cos(k2)*d3 + cos(k4)*cos(k3)*sin(k1) - .... and so on for about 3 full lines in notepad), and would like a symbolic equation as output if this is possible.
To be more specific, I would like to be able to input my equations of X, Y, Z instead of fixed coordinates.
Can I do this somehow? Would appreciate any help I can get.
0 Comments
Answers (1)
John D'Errico
on 9 Feb 2015
Not really. Certainly not trivially. The problem is, these are line segments, not lines.
It is not too difficult to compute the shortest distance between a pair of lines, of infinite extent. But the minimal distance between line segments has a problem.
The points of closest approach may lie at an endpoint of one or both of the segments, but that will often not correspond to the points of closest approach of the extended lines. So any expression for the minimal distance would essentially involve an if statement, or something equivalent to one.
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!