# Transformation matrix: rotation angles

• Jan 19th 2013, 01:15 PM
irure
Transformation matrix: rotation angles
Hi,

I have got a doubt about how to create a transformation matrix for two rotation angles in extrinsic axes. I try to explain what I want to do:

We have got x,y,z axes system that has been rotated by two angles, alpha (around x axis) and beta (around y axis), obtaining a new axes system x',y',z'. I would like to get the transformation matrix between them: [X'] = [A][X].

I learnt that when we rotate around an axis , we get [X']=[A][X]. If we rotate again around the new y' axis we get [X''] = [B][X']. The whole transformation is [X'']=[A][B][X]. But in this case, we rotate around " y " and not " y' ". How should I proceed to get the transformation matrix?

Thank you very much in advance.
• Jan 19th 2013, 02:48 PM
chiro
Re: Transformation matrix: rotation angles
Hey irure.

What you did is correct where X'' = ABX will compose two rotations and return the vector of those composed transformations.

Just make sure that you don't have gimbal lock and do the compositions in the right order and then multiply the matrices to get the final transformation matrix which is used to transform your original vector.
• Jan 20th 2013, 11:06 AM
irure
Re: Transformation matrix: rotation angles
Hey Chiro,

I guess this is not correct, because the second rotation is not done in the new y' axis, but in the first static one (y).

I will try to explain it again. I have a plane which has been rotated by two angles. Now, I want to express the new plane in the old one by two rotation angles alpha and beta, expressed in x and y (original axes).

If we rotate a plane around x axis, we get that:
x' 1 0 0 x
[ y' ] = [ 0 cos(alpha) sen(alpha) ] [ y ]
z' 0 -sen(alpha) cos(alpha) z

If we would rotate around y:

x' cos(beta) 0 sen(beta) x
[ y' ] = [ 0 1 0 ] [ y ]
z' -sen(beta) 0 cos(beta) z

Well, and what happens if we do both rotations? How can I express the transformation?

I hope it is clear this time. Could anybody help me?
• Jan 20th 2013, 03:25 PM
chiro
Re: Transformation matrix: rotation angles
Like I said, you just compose the two in the order you want by multiplying by a composition of matrices AB instead of A.

Also like I said, check for gimbal lock in cases like this (and use quaternions and quaternion interpolation to get around it).

Just decide what axes are going to be used for each rotation and then supply the angles and compose the two matrices.

You can rotate around arbitrary axis and even make the second one a function of the first if you choose to.