计算两行(线段)在3D之间的最短距离 [英] Calculating the shortest distance between two lines (line segments) in 3D

查看:323
本文介绍了计算两行(线段)在3D之间的最短距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个线段:X1,Y1,Z1 - X2,Y2,Z2和X3,Y3,Z3 - X4,Y4,Z4

I have two line segments: X1,Y1,Z1 - X2,Y2,Z2 And X3,Y3,Z3 - X4,Y4,Z4

我想找到两段之间最短的距离。

I am trying to find the shortest distance between the two segments.

我一直在寻找一个小时一个解决方案,但他们都似乎与线,而不是直线段工作。

I have been looking for a solution for hours, but all of them seem to work with lines rather than line segments.

任何想法如何去了解这一点,或者furmulae的任何资源?

Any ideas how to go about this, or any sources of furmulae?

推荐答案

一个基本的方法是相同的计算2条线之间的最短距离,但有一个例外。

One basic approach is the same as computing the shortest distance between 2 lines, with one exception.

如果你看看大多数算法寻找2线之间最短的距离,你会发现,它发现在每个是最接近线的点,然后从他们计算出的距离。

If you look at most algorithms for finding the shortest distance between 2 lines, you'll find that it finds the points on each line that are the closest, then computes the distance from them.

诀窍扩展这对分段(或射线),是看是否该点是线的端点中的一个之外,如果是的话,则使用实际最近点的结束点,而不是在无限线

The trick to extend this to segments (or rays), is to see if that point is beyond one of the end points of the line, and if so, use the end point instead of the actual closest point on the infinite line.

有关具体的示例,请参见:

For a concrete sample, see:

<一个href="http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm">http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm

更具体地说:

<一个href="http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm#dist3D_Segment_to_Segment">http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm#dist3D_Segment_to_Segment()

这篇关于计算两行(线段)在3D之间的最短距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆