Clarifying the term "rotation order" for combined rotations

598 Views Asked by At

I'm finding different answers when it comes to combine a set of rotations (matrices or quaternions).

Let's assume we want to combine the rotations Ra, Rb and Rc in the following way: rotate (an object) using Ra, then applying Rb and then Rc. So for me, the "rotation order" would be Ra -> Rb -> Rc.

If we want to combine Ra, Rb and Rc in a single rotation R, most sources I found state that the result would be:

R = Rc * Rb * Ra.

Example source: http://www.staff.city.ac.uk/~sbbh653/publications/euler.pdf (page 2)

However, on the other side, I also saw it vice versa:

R = Ra * Rb * Rc

Source: http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/ (Successive Rotations)

So I made a test by myself using the Unity3D engine:

    // hierarchy:
    //
    //  localJoint0
    //      localJoint1
    //          localJoint2
    //
    //  globalJoint

    // apply angles to local axis for each joint in its place in the hierarchy
    // angle0..2 can be any arbitrary values und axis0..2 arbitrary 3D vectors
    Quaternion rot0 = Quaternion.AngleAxis(angle0, axis0);
    Quaternion rot1 = Quaternion.AngleAxis(angle1, axis1);
    Quaternion rot2 = Quaternion.AngleAxis(angle2, axis2);
    localJoint0.localRotation = rot0;
    localJoint1.localRotation = rot1;
    localJoint2.localRotation = rot2;

    // compose a global rotation from the single local rotations
    // and apply it to globalJoint outside the hierarchy
    globalJoint.rotation = rot0 * rot1 * rot2;

The result is, that the rotation of localJoint2 is the same as globalJoint (visually confirmed in the 3D view) so I could describe the combined rotation always in the "intuitive" order. This would favor source 2. But maybe the context in my case is misleading (hierarchy)?

Could anyone explain why the "reverse" order would make sense? Or in what context this applies?