rotation

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

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 on other sites
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 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 on other sites
Quote:
 Original post by RPTDuse 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/

• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 17
• 46