September 27, 2006
A lot of people are confused by this, and in one sence its the software duping the user into thinking that there rotation, be it local or world is what it actually is. Rotations arent angles there either a collection of vectors from an origin or a vector and a twist as in angle axis or a quaternion – quaternions are slightly different in that they have two sets – imaginary in 4 dimensions and referenced in 3 dimensions. The twist i.e w of I, J, and K is part of the algorithm and cant be torn away.
The matrix is the easiest way to understand, imagine a graph in three dimensions 3 arrows one down the x, one down the y and one down the z. Now you derive three vectors, three points on the graph for each axis.
Now the length of the line from the origin [0,0,0] to each vector is the unit length, and by adding them all up should equal 1 – this is important and is also known as normalisation. Why is normalisation important well first off scale and rotation are linked in a matrix, scale I regard is a happy result of rotation. The normalised unit length being 1 means a scale of 100% 0.5 = 50% and so on – you can still get non-uniform scaling.
Now another import part is each vector, they have to be 90 degree from each other. Else what happens – well you get sheering, because scale is a result.
So in essence your defining an axis for the rotation, with three vectors from the origin like so:
([1,0,0], [0,1,0], [0,0,1] [0,0,0]) – the first three are you vectors to build your rotation, the last is position. Position is simple its just an offset from the origin.
Now another factor is the parent – transformations are relative to the parent. So if theres no parent then [0,0,0] position would be world center. Where as if it had a parent, [0,0,0] would be the parents pivot.
Euler is a bad way of representing rotations, because its really a system to make each vector x y z. Gimbal lock occurs because an axis after being evaluated, doesnt re-evaluate itself when the next is rotation. So when you rotate x 90, then y 90. Y is adding x – and so on and so forth. It means that once you get to z, your rotating x too because x has been rolled onto two axis.
One way to solve this is to project the axis into quaternions and re-evaluate the axis everytime you rotate it.