确定一个点是否在三角形内部的三维空间 [英] Determine whether a point is inside triangle in 3D space
本文介绍了确定一个点是否在三角形内部的三维空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个3D三角形重新由3倍的3D顶点psented $ P $。
I have a 3D triangle that is represented by 3x 3D vertices.
我在寻找一种算法,必须包括下列要求:
I'm looking for an algorithm that must cover the following requirements:
- 的点在同一平面上的三角和 所限定在于
- 在该点位于所述三角形的边界之内
例如:
推荐答案
定义基础矢量 B = AB C = AC 和 N = <强> B X <强> C (矢量积),其中A,B,C - 三角形顶点的坐标
再present点P在此基础上协调,解决线性方程组(未知T,U ,v)中。 高斯消元法是适合这里。
Define basis vectors b=AB, c=AC and n= b x c (vector product), where A, B, C - triangle vertices's coordinates
Represent point P coordinate in this basis, solving linear equation system (unknown t,u,v). Gaussian elimination method is suitable here.
t * b.X + u * c.X + v * n.X = P.X
t * b.Y + u * c.Y + v * n.Y = P.Y
t * b.Z + u * c.Z + v * n.Z = P.Z
点是内部根据您的图片,如果
Point is 'inside' according to your picture, if
0 <= t <= 1
0 <= u <= 1
and
t + u <= 1
这篇关于确定一个点是否在三角形内部的三维空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文