• Advertisement

Archived

This topic is now archived and is closed to further replies.

plane and point

This topic is 5059 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have 3 vectors (point) and I want to generate a plane, which I use the D3DXPlaneFromPoints for the task. Now my challege is that, if I had a point, and I want to find out whether that point is lie on the plane, how do I do this? should I use the dot or cross product.

Share this post


Link to post
Share on other sites
Advertisement
1) Get a normal n = (nx,ny,nz) of your triangle (which the three points form) by taking the cross product of two connection vectors between the points. That nomral of course is also a normal to the plane the points lie in. You can normalize it if you want (might be helpfull to calculate distances from the plane later).

2) take the vector v to any of the points and calculate d = n*v.

3) Since v by definition has to satisfy the plane equation v*n + D = 0 => D = -d.

4) Now that you´ve got your plane equation Ax+By+Cz+D=0 (n=(A,B,C) calculated in the 1st step; D = -d) you can plug any coordinates (x,y,z) in it. If the equation is fullfilled, then the point (x,y,z) lies on the plane. Otherwise it doesn´t.

Above doesn´t use DirectX (I never used that before) but I´d bet your DX-function gives you something like the plane equation as a result. In that cae you only need step 4.

Share this post


Link to post
Share on other sites
it a review, but how do I find the normal of my vector, especially if you had 3 vector, how do you find the normal of that.

Share this post


Link to post
Share on other sites
3 points v0, v1, v2 define a plane (N, d), where

N = (v1 - v0) x (v2 - v1)
d = -(v0 . N)

plane equation is then

Nx * x + Ny * y + Nz * z + d = 0

so, a point P(x, y, z) is on the plane if

N . P + d = 0

so you have a point P, you have the normal N defined by the cross product of two segments [v0, v1] and [v1, v2], you have d, which is the distance of the origin from the plane, so there you go.

as a side note,

A x B = Vector((Ay*Bz-Az*By), (Az*Bx-Ax*Bz), (Ax*By-Ay*Bx));
A . B = Ax*Bx + Ay*By + Az*Bz

Share this post


Link to post
Share on other sites

  • Advertisement