Why are quaternions used for rotations?

后端 未结 8 1023
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 07:42

I\'m a physicist, and have been learning some programming, and have come across a lot of people using quaternions for rotations instead of writing things in matrix/vector fo

相关标签:
8条回答
  • 2020-12-07 08:15

    It's worth bearing in mind that all the properties related to rotation are not truly properties of Quaternions: they're properties of Euler-Rodrigues Parameterisations, which is the actual 4-element structure used to describe a 3D rotation.

    Their relationship to Quaternions is purely due to a paper by Cayley, "On certain results related to Quaternions", where the author observes the correlation between Quaternion multiplication and combination of Euler-Rodrigues parameterisations. This enabled aspects of Quaternion theory to be applied to the representation of rotations and especially to interpolating between them.

    You can read the paper here: https://archive.org/details/collmathpapers01caylrich . But at the time, there was no connection between Quaternions and rotation and Cayley was rather surprised to find there was:

    In fact the formulae are precisely those given for such a transformation by M. Olinde Rodrigues Liouville, t. v., "Des lois géométriques qui régissent les déplacements d'un système solide [...]" (or Comb. Math. Journal, t. iii. p. 224 [6]). It would be an interesting question to account, a priori, for the appearance of these coefficients here.

    However, there is nothing intrinsic about Quaternions that gives any benefit to rotation. Quaternions do not avoid gimbal lock; Euler-Rodrigues parameterisations do. Very few computer programs that perform rotation are likely to truly implement Quaternion types that are first-class complex mathematical values. Unfortunately, a misunderstanding of the role of Quaternions seems to have leaked out somewhere resulting in quite a few baffled graphics students learning the details of complex math with multiple imaginary constants and then being baffled as to why this solves the problems with rotation.

    0 讨论(0)
  • 2020-12-07 08:20

    The usual reasons I see are no gimble lock, or numerical issues.

    And they are good reasons.

    As you already seem to understand, quaternions encode a single rotation around an arbitrary axis as opposed to three sequential rotations in Euler 3-space. This makes quaternions immune to gimbal lock.

    Also, some forms of interpolation become nice and easy to do, like SLERP.

    ...or using two overlapping coordinate systems.

    From a performance perspective, why is your solution better?

    I could go on, but quaternions are just one possible tool to use. If they do not suit your needs, then do not use them.

    0 讨论(0)
提交回复
热议问题