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

查看:23
本文介绍了计算 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?

推荐答案

一种基本方法与计算两条线之间的最短距离相同,但有一个例外.

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.

具体示例见:

http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm

更具体地说:

http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm#dist3D_Segment_to_Segment()

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

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