PDA

View Full Version : Help with Rotation Matrices

Halcyon
12-29-2002, 10:50 PM
Ok i'm a little confused with exactly how rotation matrices work. Say you have a model located at coordinates (0,0,0) or the origin of the world space...when you apply a rotation, the resulting coordinates will still be (0,0,0). If it were not centered at the origin, you'd get the location of the object but now the direction it is facing. Here is what i mean:

This is a rotation of an object located the origin around the z axis ( oh and ? is actually a theta):

[cos ? -sin ? 0 0] [ 0 ] [ 0 ]
[sin ? cos ? 0 0] * [ 0 ] = [ 0 ]
[0 0 1 0] [ 0 ] [ 0 ]
[0 0 0 1] [ 1 ] [ 1 ]

As you can see there is no indication of an actualy rotation. I'm read the book Real-Time Rendering and i'm gleaning this from there (the rotation matrix only). But from all the other transforms in the book it seems like the correct operation to get the resulting transformb X would be to use this formula:

X = Rz(?) * p

Where Rz(?) is the 4x4 rotation matrix in homogeneous coordinates and p is the point in matrix form with homogeneous coordinates.

Thanks for all the help in advance and i hope everyone has a happy new years!!

- Halcyon

P.S. Sorry for the crude matrix diagrams...i didn't know or a better way of doing them!

Edit: Sorry matrices were not aligned right

[This message has been edited by Halcyon (edited 12-29-2002).]

rixed
12-30-2002, 02:01 AM
I didn't understand what exactly gives you some trouble.

If you have a vertex at coordinate (x,y,z) you understand that by multiplying (x,y,z,1) by a 4x4 matrix will change this position, didn't you ?

And that by multiplying all the vertex of a geometric shape by an orthogonal(1) 4x4 matrix you will change the position and the orientation of the model without changing its shape, didn't you ?

((1) orthogonal for the rotation part of the matrix, that is : the rotation part of the matrix can be represented as an orthogonal coordinate system)