shortest vector between two line segments
1 次查看(过去 30 天)
显示 更早的评论
Hi, im looking to find the shortest vector between two line segments.
The purpose is that i generate two line segments in space, and then i want to move one toward the other in the shortest distance possible. I have seen some existing matlab codes that provide the shortest distance between line segments - but in this case i need direction as well.
any help would be greatly appreciated!
1 个评论
Roger Stafford
2014-3-13
编辑:Roger Stafford
2014-3-13
When you say "the shortest vector between two line segments", do you mean that the ends of a connecting vector must lie within the bounds of each of the respective line segments, or can it end on linear extensions of each line segment? I ask this because finding the former takes more processing than the latter, there being a comparatively simple formula for the shortest vector between two infinitely long straight lines.
回答(1 个)
John D'Errico
2014-3-13
Any code that can find the shortest distance between the segments must also implicitly know the points of interest on each segment. Subtracting those two points gives the vector you need.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!