在 3D 中计算点到三角形距离的最快方法? [英] Fastest way to compute point to triangle distance in 3D?

查看:36
本文介绍了在 3D 中计算点到三角形距离的最快方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

计算点到 3D 三角形的最小距离的一种明显方法是将点投影到三角形平面上,确定结果点的重心坐标,并使用它们来确定投影点是否位于三角形.如果不是,请将其重心坐标限制在 [0,1] 范围内,这将为您提供位于三角形内的最近点.

One obvious method for computing the minimum distance from a point to a 3D triangle is to project the point onto the plane of the triangle, determine the barycentric coordinates of the resulting point, and use them to determine whether the projected point lies within the triangle. If not, clamp its the barycentric coordinates to be in the range [0,1], and that gives you the closest point that lies inside the triangle.

有没有办法加快或以某种方式简化它?

Is there a way to speed this up or simplify it somehow?

推荐答案

有不同的方法可以找到从点 P0 到三角形 P1,P2,P3 的距离.

There are different approaches to finding the distance from a point P0 to a triangle P1,P2,P3.

  1. 3D 方法.将点投影到三角形平面上,然后使用重心坐标或其他一些方法来找到三角形中最近的点.以通常的方式找到距离.

  1. The 3D method. Project the point onto the plane of the triangle and use barycentric coordinates or some other means of finding the closest point in the triangle. The distance is found in the usual way.

二维方法.对点应用平移/旋转,使 P1 位于原点,P2 位于 z 轴,P3 位于 yz 平面.投影是点 P0 是微不足道的(忽略 x 坐标).这导致了一个二维问题.使用边方程可以确定三角形的最近顶点或边.计算距离很容易.

The 2D method. Apply a translation/rotation to the points so that P1 is on the origin, P2 is on the z-axis, P3 in the yz plane. Projection is of the point P0 is trivial (neglect the x coordinate). This results in a 2D problem. Using the edge equation it's possible to determine the closest vertex or edge of the triangle. Calculating distance is then easy-peasy.

这篇论文 将两者的性能与 2D 方法获胜进行比较.

This paper compares the performance of both with the 2D method winning.

这篇关于在 3D 中计算点到三角形距离的最快方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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