Project a point on the same plane as the polygon

It’s hard for me to figure out how to do this. I have a polygon defined by three points. I also have a point somewhere in space. I want to move a point somewhere in space to be on the same plane as the polygon. As far as I understand, it is well known how to do this. However, this is not well known to me.

I cannot find any direct algorithms or solid explanations of how this is done.

I looked at this: http://www.odeion.org/pythagoras/pythag3d.html

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

Unfortunately, my math is pretty weak, but I am more than willing to study.

+3
source share
1 answer

The first conceptual step that will be useful is to determine if the point is in the same plane as the three points of your polygon that describe the plane. One way to do this is to compute the normal vector for the plane β€” name it n β€” and define the plane using n and one of the three points (name this point r 0 ).

The calculation of the normal vector for a plane can be performed in several ways (see here ). For this situation, the most convenient approach is the cross product between two vectors in the plane (find two vectors using points from the defining polygon).

Once you know n, you can check if the point r is in the plane with the point product between n and the vector (r 0 - r). See here for more details.

Then you can use orthogonal projection at any point to get a new point on the plane.

Example

Say I have three points:

  • p 1 : [1, 1, 1]
  • p 2 : [1.5, 6, 3]
  • p 3 : [2, -1, 5].

First create a vector that is normal to the plane created by these points. Let be

  • v 1 = p 1 - p 2 = [-0.5, -5, -2]
  • v 2 = p 1 - p 3 = [-1, 2, -4].

Normal vector of these two then

  • n = v 1 xv 2 = [24, 0, -6].

For convenience, we allow the normalization of n, so now n = [0.9701425, 0, -0.24253563].

Now we define a plane on n and let r 0 = p 1 .

Allows you to enter a new point r, which is not in the plane (you can check by taking the point product n and (r 0 - r):

  • r = [4, 4, 4]

One way to β€œmove” r to the plane is to β€œshift” it down the normal vector until it is on the plane (this is the orthogonal projection). This is done by determining which part of n is in the vector v 3 = (r 0 - r) (called the scalar projection ). The scalar projection in this case gives a new vector v 3m = [-0.88235294, -3, -3.52941176]. This computes v 3 - n * dot (n, v 3 ). You can check this on the plane because it is orthogonal to n.

Now we can restore the point:

  • r m = r 0 - v 3m = [1.88235294, 4, 4.52941176].

You can check if this point is really in the plane:

  • point (r 0 - r m , n) = 0.
+9
source

All Articles