When do I need to use quaternions?

后端 未结 6 1097
逝去的感伤
逝去的感伤 2021-02-01 05:29

I have been carrying out 2D and 3D operations, including graphics, for many years and have never used quaternions so I don\'t have a feel for them. I know that they can be used

相关标签:
6条回答
  • 2021-02-01 06:09

    They have a smaller memory footprint than rotation matrices and they are more efficient than both matrix and angle/axis representations.

    Also:

    • It's extremely easy to interpolate between two quaternions, which is useful for smooth camera movements etc.
    • Unit normalisation of floating point quaternions suffers from fewer rounding defects than matrix representations.
    0 讨论(0)
  • 2021-02-01 06:16

    Quaternions have many advantages over Euler angles and are often preferable for 3D rotations:

    • Easier (and well-defined) interpolation between quaternions (or: orientations): the resulting movement has constant angular velocity around a single axis, which is often aesthetically more pleasing. This process is called "slerp" and critical for animation/rotation blending. Furthermore, quaternion interpolation does not suffer from Gimbal locks.
    • They are easy to renormalize.

    Disadvantages:

    • The main disadvantage is that they require a bit more math and are less intuitive than Euler/Cardanic angles.
    • Compared to affine transformation matrices, Quaternions only contain a rotation, and no translation and scaling.
    0 讨论(0)
  • 2021-02-01 06:18

    With quaternions you also handle the problem of the gimbal lock. And they are easier to work with when you want to perform arbitrary rotations.

    0 讨论(0)
  • 2021-02-01 06:26

    Compared to Euler angles they are simpler to compose and avoid the problem of gimbal lock.

    Compared to rotation matrices they are more numerically stable and the representation (4 numbers) is more compact.

    0 讨论(0)
  • 2021-02-01 06:30

    The advantage of quaternions over matrices is not only faster computation, but mostly because a matrix representation of successive rotations around arbitrary angles eventually give in to dreadful floating-point round-off errors and no longer represent proper, affine rotations. "Restoring" a rotation matrix is computationally more expensive than normalizing a quaternion. Therefore, quaternions should be chosen over pure rotation matrices.

    0 讨论(0)
  • 2021-02-01 06:34

    Pros of quaternions

    1. Fast multiplication
    2. Fast to/from matrix conversion
    3. Avoid additional (from computation) noise (scale , shear) , and represent pure rotation
    4. Simple rotation interpolation, in custom case for real time animation can be used linear interpolation.
    5. Some tricky operations available, fast rotation integration, twist swing decompositions

    Cons.

    1. Transformation of vector is not so fast as with 3x3 matrix.
    2. Contains 4 scalar, but compact rotation representation can use only 3.
    0 讨论(0)
提交回复
热议问题