Matrix multiplication is not commutative. What is the work around or solution?

后端 未结 3 1508
一个人的身影
一个人的身影 2021-01-29 09:52

I basically have this problem:

Generic Simple 3D Matrix Rotation Issue

and it is driving me mad. I have been on Google for hours but cannot find any posts about

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-29 10:29

    The solution/workaraound is to apply the rotations in the correct order.

    If you have rotation matrices A, B and C and want to apply them to matrix M in order A, B, C then the solution is:

    First apply A:

    A * M
    

    Then B:

    B * A * M
    

    And finally C:

    C * B * A * M
    

    If you want to apply ABC frequently you can precalculate the combined rotation matrix R:

    R = C * B * A
    

    and then you can apply R to M:

    R * M
    

提交回复
热议问题