Shortest distance between two line segments in 3D with symbolic equations?

9 ビュー (過去 30 日間)
AC_R
AC_R 2015 年 2 月 9 日
コメント済み: AC_R 2015 年 2 月 11 日
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.

回答 (1 件)

John D'Errico
John D'Errico 2015 年 2 月 9 日
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.
  1 件のコメント
AC_R
AC_R 2015 年 2 月 11 日
Hi! Thanks for responding.
Could it work if one conciders the lines to be infinite? It may be sufficient to do it this way. I wrote a code in matlab yesterday, but it gives me an output of 90000 (ninety thousand) characters, which seems excessive. I have to think there is a way to get a shorter resulting equation.
In my MatLab code I basically just followed the formula for shortest distance between lines, with my equations for X,Y,Z as input. Nothing else.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeJust for fun についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by