为什么沿三轴旋转不同于分别旋转每个轴?

时间:2017-06-23 09:21:47

标签: rotation linear-algebra matrix-multiplication vrml

所以我定义了这个Box,其大小为(1,2,3),我沿着所有三个轴旋转45°:

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

但是当我分别沿每个轴应用相同的旋转时,我得到另一个结果:

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 }
            }
          ]
        }
      ]
    }
  ]
}

维基百科告诉我,我可以将所有旋转矩阵相乘:R = R(x)R(y)R(z)?

这是上述代码的结果:

Result

1 个答案:

答案 0 :(得分:1)

您描述的第一个旋转不是围绕三个轴的旋转,而是围绕轴(1,1,1)的旋转,这是不同的。通常情况下,你没有得到预期的结果。 如果您希望可以根据维基百科的公式计算轴(1,1,1)和角度45的旋转矩阵,并将其与每个轴x,y,z和角度45的旋转矩阵的乘法进行比较会看到你得到不同的矩阵。