本文介绍了最快的计算点到三角形的距离在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.

2D法。施加平移/旋转到点,使得P1是在原点,P2是z轴,P3在yz平面。投影是点P0是微不足道的(忽略x坐标)。这导致了2D问题。利用边缘方程有可能来确定三角形的最接近顶点或边。计算距离是那么容易peasy。

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的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!