Asked by:
What is the default sequence of hierarchical rotation matrix, e.g. xyz ?

I wonder that what a sequence of rotation matrix provided by microsoft kinect sdk version 1.6. given from code below
Matrix rotMat = skeleton.BoneOrientation[JointType.KneeRight].HierarchicalRotation.Matrix;
I want to know its sequence for example rotMat = Rz*Ry*Rx in order to compute the euler angle.
I have been finding the document telling about this but I still haven't got it.
The solution I think if anyone doesn't know is using quaternion and convert it to euler. Does anyone know?
Thank you so much.
Question
All replies



Check out...
http://en.wikipedia.org/wiki/Rotation_matrix
http://www.soi.city.ac.uk/~sbbh653/publications/euler.pdf
As I understand it, there is no default sequence of Euler rotations. If you want to decompose the matrix into Euler angles, the order would depend on the sequence you require for whatever purpose you intend.
Many papers will give the rotations as Rzyx (as you state): a rotation about x, followed by a rotation about y, followed by a rotation about z. The links above both have formulas to compute Euler angles in that sequence.
I have been working on a system that wants angles in HPR (heading, pitch, roll). In the Kinect sensor coordinate system, that is most analagous to Z (roll), followed by X (pitch), followed by Y (heading): so, the rotation matrix would be Ryxz.
(cos y)(cos z) + ((sin y)(sin x))(sin z), (cos y)(sin z) + ((sin y)(sin x))(cos z), (sin y)(cos x)
(cos x)(sin z), (cos x)(cos z), sin x
(sin y)(cos z) + ((cos y)(sin x))(sin z), (sin y)(sin z) + ((cos y)(sin x))(cos z), (cos y)(cos x)Angles can then be computed as...
doublerx = asin( rotationMatrix.M23 );
doublery = atan2( rotationMatrix.M13 / cos( rx ), rotationMatrix.M33 / cos( rx ) );
doublerz = atan2( rotationMatrix.M21 / cos( rx ), rotationMatrix.M22 / cos( rx ) );
Double check for errors. Hope that helps.