如何确定点是否在

如何确定点是否在

本文介绍了如何确定点是否在 3D 三角形内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个算法 (3D),它可以确定点是否属于三角形.而且,如果确实如此,我想知道三角形中某个点和另一个点之间的距离.三角形可以稍微旋转,但如果点在三角形垂直范围之外,则不应视为三角形内部.

I need an algorithm (3D), which would determine if point belongs to a triangle. And also if it does I want to know the distance between some point in triangle and a another point. Triangles can be slightly rotated, but if point is outside triangles vertical reach then it should not be considered as inside the triangle.

现在我意识到,我的问题可能没有多大意义,所以这是一张图片,它解释了我想要什么.

Now I realize, my question probably doesn't make a lot of sense so here's the picture, which explains what I want.

灰线显示,三角形实际面向的方向.

Grey lines display, which way triangle is actually facing.

实际上我并不是想检查一个点是否在棱镜内,但是在我发现点是否在三角形内(不完全是,可能在上面或下面)之后,我需要找到之间的距离点和它所属的三角形.如果该点在三角形内,则取决于距离函数最终将返回.允许有一点不准确.但是,也许我想检查一个点是否在棱镜内,但不知道.我只是数学很差,所以我不知道正确的术语.

It's not actually that I want to check if a point is within a prism, but I after i find out if point lies within triangle (not exactly, might be on top of or below) then I need to find the distance between point and a triangle it belongs to. And depending on the distance function will finally return if that point is inside the triangle. A little inaccuracy is allowed. However, maybe I want to check if a point is within a prism, but do not know that. I am just horrible at math so I am not aware of correct terminology.

推荐答案

这似乎是 用于查询位于三角形内的点的数据结构.您可以在 3D 中使用相同的方法:在 3D 中,平面将空间分成两半:一个点位于平面的一侧或另一侧.楔形是平面的集合:只需将给定点的 which_side_of_the_plane 信息与构成楔形的所有平面结合.

This seems like the 3D equivalent of Data structure to query points which lie inside a triangle.You could use the same method in 3D: in 3D, a plane cuts the space in two halves: a point is either at one side of the plane or at the other side. The wedge-shape is a collection of planes: just combine the which_side_of_the_plane information for a given point with all the planes that build up the wedge.

这篇关于如何确定点是否在 3D 三角形内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 06:00