Jump to content
  • Advertisement
Sign in to follow this  
tendifo

rotation

This topic is 5024 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'm attempting to create my own graphics renderer, but I'm sort of stuck. If a point in a 3-d world is defined by (x, y, z), how do I rotate this point around the x, y, or z axis by a radians?

Share this post


Link to post
Share on other sites
Advertisement
use a 4x4 matrix. should be mentioned somewhere here on the page what you need but a 4x4 matrix composed of a couple of sin(arc),cos(arc) values at the right places... am too lazy to copy past this here... google helps.

Share this post


Link to post
Share on other sites
There are plenty of references for rotation matrices. You can derive it fairly easily on your own. You just look at what should happen to the standard basis vectors, i.e. (1,0,0), (0,1,0) and (0,0,1). A matrix times a vector is a linear combination of the columns of the matrix. With (1,0,0) that is just the first column. So if you rotate (1,0,0) by t around the z axis you should get (cos(t),sin(t),0). (0,l,0) should go to (-sin(t),cos(t),0) so that is your second column. Finally (0,0,1) should be unchanged so that is your last column.

Share this post


Link to post
Share on other sites
Quote:
Original post by RPTD
use a 4x4 matrix. should be mentioned somewhere here on the page what you need but a 4x4 matrix composed of a couple of sin(arc),cos(arc) values at the right places... am too lazy to copy past this here... google helps.
You don't strictly NEED a 4x4 matrix for 3D rotation, a 3x3 one will suffice. However if you want to add translation as well then you need it to be at least 3x4 or 4x3.

Here's a link for ya: http://www.makegames.com/3drotation/

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!