Jump to content
  • Advertisement


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


Rotating a triangle onto the X-Y plane

This topic is 6494 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

How do you rotate a triangle positioned anywhere in 3d space onto the X-Y plane? It really doesn''t matter where on the plane it ends up for my particular implementation. If I remember my geometry right, I could just pick a point on the triangle, and put that it''s image at (0,0). Then I could find the distace from that point to one of the other ones, and put it at (0,d). Then I''d find the angle between the 2 lines coming out of the first point and the distance to the third point, and put the last point at (cos(angle)*d, sin(angle)*d). This would result in a triangle that is on the X-Y plane with the same dimensions as the original, right? Is there a simpler way to do this?

Share this post

Link to post
Share on other sites
If you have the normal, the axis to rotate the triangle on is the normal to the triangle''s normal and the Z axis. The angle to rotate the triangle is the angle between the triangle''s normal and the Z axis.

But why do you want to rotate the triangle to the XY plane? If your reason is to solely reduce the problem to 2 dimensions, such as doing a point location test, then a better and simpler solution is this:
Find the largest component of the trinagle''s normal and drop this component from the triangle''s coords. In other words, if Y is the largest component of the triangle''s normal, then drop Y from all of the triangle''s vertices, giving you just X and Z. You have then projected the triangle to the XZ plane. This is sufficient for many tests.

On the other hand, if you truly need to rotate the triangle to the XY plane, then you can''t drop the Z component, because this is only projection.

Share this post

Link to post
Share on other sites

  • 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!