Skip to main content
gamedev.net
🔒 Locked

rotation

Started by tendifo Oct 16, 2004 at 4:30 PM 2 replies 400+ views
Original Post
tendifo
tendifo
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?
RPTD
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.
Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine
LilBudyWizer
LilBudyWizer
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.
Keys to success: Ability, ambition and opportunity.
iMalc
iMalc
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/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.