Jump to content
  • Advertisement
Sign in to follow this  
Lmc

normalizing a plane

This topic is 4729 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 a plane defined by three (at least) points in 3-space. From that I can compute the equation of the plane. What I need to do is rotate the coordinate system so that an axis is parallel to the normal vector of the plane, in effect cancelling out one of the coordinates so I can measure the plane . This has got to be an important transformation in texture mapping, but for the life of me I cannot find it discussed anywhere (in terms I can understand - that's likely my problem). I'm an old engineer, started with FORTRAN II, and probably missed a lot along the way. Can someone kindly point me towards a down-to-earth math explanation or perhaps even C code? Thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
If you have 3 plane points, you can compute 2 vectors that belong to the plane (P2 - P1 and P3 - P1). The cross product gives you the plane normal, which is perpendicular to the plane, so you have a basis for a coordinate system where the plane is one of the canonical axes, but this base isn't orthonormal.

First normalize the three vectors, then take the cross product of one of the original vectors and the normal vector. These three vectors (P2-P1, N and (P2-P1)xN) form an orthonormal basis for the coordinate system you're looking for. So if you use them as the columns of a 3x3 matrix, that matrix transforms from the canonical R3 to your plane's coordinate system. The inverse (which is the transpose in this case) maps plane points to canonical R3, where you can discard one of the coordinates (the one you mapped to N) and measure in 2D using the other 2.

This is off the top of my head, so I may have missed some detail.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!