Sign in to follow this  
tendifo

rotation

Recommended Posts

tendifo    146
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
RPTD    340
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
LilBudyWizer    491
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
iMalc    2466
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this