问题
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 for certain operations that are difficult in Euler angles and also that they can be used to find the rotation required to best fit one set of coordinates (X1, X2...XN, X=(xyz)) onto another (X1', X2'... XN').
Are there places where quaternions are essential? And are there places where they make solutions more elegant or more efficient?
回答1:
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.
回答2:
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.
回答3:
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.
回答4:
Pros of quaternions
- Fast multiplication
- Fast to/from matrix conversion
- Avoid additional (from computation) noise (scale , shear) , and represent pure rotation
- Simple rotation interpolation, in custom case for real time animation can be used linear interpolation.
- Some tricky operations available, fast rotation integration, twist swing decompositions
Cons.
- Transformation of vector is not so fast as with 3x3 matrix.
- Contains 4 scalar, but compact rotation representation can use only 3.
回答5:
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.
回答6:
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.
来源:https://stackoverflow.com/questions/1840314/when-do-i-need-to-use-quaternions