突出的点到同一平面的多边形多边形、点到、平面、突出

2023-09-08 00:49:39 作者:承诺似雾如风

我无法掌握如何做到这一点。我具有由三个点所限定的多边形。我也有在空间中的点的某处。我想某处移动点在空间中是在同一平面上的多边形。据我了解,这是众所周知如何做到这一点。然而,它不是公知的由我

I'm having trouble grasping how to do this. I have a polygon defined by three points. I also have a point somewhere in space. I want to move the point somewhere in space to be on the same plane as the polygon. From what I understand, it is well-known how to do this. However, it is not well-known by me.

我找不到任何简单的算法或如何做到这一点实的解释。

I can't find any straight forward algorithms or solid explanations of how this is done.

我一直在寻找这样的: http://www.odeion.org/pythagoras/ pythag3d.html

I've been looking at this: http://www.odeion.org/pythagoras/pythag3d.html

不过,这将使我的距离顶点来,而不是点。我可以看到,如果多边形仅限于2D,将是有益的,但​​对我来说,它可能有任何方向。

But that will give me distances to rather than points of the vertices. I can see how that would be useful if the polygon was limited to 2d, but in my case, it may have any orientation.

不幸的是我的数学是相当弱的,但我更愿意去学习。

Unfortunately my math is fairly weak, but I'm more than willing to learn.

推荐答案

第一概念性步骤,这将是有帮助的是有一种方法,以确定是否一个点位于相同的平面从多边形的三个点,描述了飞机。一种方法做,这是计算一个正常的矢量飞机 - 把它的 N 的 - 并使用的 N 的和三个点中的一个定义平面(调用点的研究 0 的)。

The first conceptual step that will be helpful is to have a way to determine if a point lies on the same plane as the three points from your polygon that describe the plane. One approach to doing this is to compute a normal vector for the plane -- call it n -- and define the plane using n and one of the three points (call that point r0).

计算为平面的法线矢量可以以多种方式进行(见此处)。对于这种情况,最方便的方法是采取两个向量是在平面(发现使用点从限定多边形两个向量)之间的叉积

Computing a normal vector for the plane can be done in several ways (see here). For this situation, the most convenient approach is taking the cross product between two vectors that are in the plane (find two vectors using the points from the defining polygon).

一旦你知道的 N 的,你可以再测试,如果一个点的研究的关键在平面上的点积之间的 N 的和矢量(研究 0 的 - 研究的)。请参阅here更多解释。

Once you know n, you can then test if a point r lies in the plane with the dot product between n and the vector (r0 - r). See here for more explanation.

您可以再使用正交投影上的任何一点得到一个新的点说就是在飞机上。

You can then use orthogonal projection on any point to get a new point that is on the plane.

让我们说我有三点:

P 1 的:1,1,1] P 2 的:[1.5,6,3] P 3 的:[2,-1,5]

让我们先创建一个向量是正常的由这些点形成的平面。让

Let's first create a vector that is normal to the plane created by these points. Let

的 v 1 = P 1 的 - P 2 = -0.5,-5,-2] 的 v 2 = P 1 的 - P 3 = [-1,2,-4]。

这两个的法线矢量,然后

The normal vector of these two is then

的 N = v 1 X v 2 的= [24,0 ,-6]。

有关方便起见,我们正常化的 N 的,所以现在的 N 的= 0.9701425,0,-0.24253563]。

For the sake of convenience, let's normalize n, so now n = [0.9701425, 0, -0.24253563].

现在我们定义了飞机通过的 N 的,让的研究 0 = P 1 。

Now we define the plane by n and let r0 = p1.

让我们引入一个新的起点,研究的,这不是在平面(您可以通过利用的 N 的和(研究 0 的 - 研究的):

Lets introduce a new point, r, that is not in the plane (you can verify by taking the dot product of n and (r0 - r):

的研究的= [4,4,4] r = [4, 4, 4]

一种方式为移动的研究的是在飞机上是滑下来的法向量,直到它是在飞机上(这是正交投影)。这是通过确定有多少做的 N 的是矢量的 v 3 的=(研究 0 - 研究的)(称为标投影)。在这种情况下,标量预测产生新的向量的 v 3M 的= [-0.88235294,-3,-3.52941176。 N 的*点( N 的 v 3 < - 这是通过的 v 3 的计算/ SUB> 的)。您可以验证这是在飞机上,因为它是正交的 N 的。

One way to "move" r to be on the plane is to "slide" it down the normal vector until it is on the plane (this is orthogonal projection). This is done by determining how much of n is in vector v3 = (r0 - r) (called scalar projection). Scalar projection in this case yields the new vector v3m = [-0.88235294, -3, -3.52941176]. This is computed by v3 - n*dot(n, v3). You can verify this is in the plane because it is orthogonal to n.

我们现在就可以恢复了一点:

We can now recover the point:

的研究 M = 研究 0 的 - 的 v 3M = 1.88235294,4,4.52941176。

您可以在飞机上验证这一点确实是:

You can verify this point is indeed in the plane:

点(研究 0 的 - 研究 M 的 N 的)= 0 dot(r0 - rm, n) = 0.