rotationlinear-algebramatrix-multiplicationvrml

Why rotation along three axis is different than rotation each axis separately?


So I have this Box defined, which has a size of (1, 2, 3) which I rotate along all three axes with 45°:

Transform {
  rotation 1 1 1 0.7854
  children [
    Shape {
      appearance Appearance { material Material {} }
      geometry Box { size 1 2 3 }
    }
  ]
}

But when I apply the same rotation along each axis separately I get another result:

Transform {
  rotation 0 0 1 0.7854
  children [
    Transform {
      rotation 0 1 0 0.7854
      children [
        Transform {
          rotation 1 0 0 0.7854
          children [
            Shape {
              appearance Appearance { material Material {} }
              geometry Box { size 1 2 3 }
            }
          ]
        }
      ]
    }
  ]
}

Wikipedia tells me I can multiply all rotation matrices like this: R = R(x)R(y)R(z)?

This is the result of the code above:

Result


Solution

  • The first rotation you describe is not a rotation around the three axis but a rotation around the axis (1,1,1) which is different. It's then normal you don't get the expected result. If you wish you can compute the rotation matrix for the axis (1,1,1) and angle 45 from the formula of Wikipedia and compare it to the multiplication of the rotation matrix for each axis x,y,z and angle 45 and you will see that you get different matrices.