Jump to content
  • Advertisement


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


3D Rotation Formulas

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

The equations are pretty trivial, and you should be able to derive them yourself with a little trig. BUT, since I'm nice, I'll give them to you.

For rotation around the z-axis:

x' = x cos za - y sin za;
y' = x sin za + y cos za;

For rotation around the x-axis:

y' = y cos xa - z sin xa;
z' = y sin xa + cos xa;

For rotation around the y-axis:

x' = x cos ya + z sin ya;
z' = - x sin ya + z cos ya;

Of course, x', y' and z' are the new coordinates. I'll let you figure out how to plug this into your code. It's not hard, but not as simple as you hoped.

Share this post

Link to post
Share on other sites
Matrices really just confuse me. So, does anyone have the straight up equations to rotate a point around the x, y, and z axis? This is my ultimate goal:

BOOL RotatePoint(CVector* point, float xa, float ya, float za);
point.screen_x = // Rotated x around xa, ya, and xa.
point.screen_y = // Same as above but for y
point.screen_z = // Ditto

return TRUE;

Any help would be great! Thanks!

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!