Question

Tell me if I am wrong.

I'm starting using quaternions. Using a rotation matrix 4 x 4 (as used in OpenGL), I can compute model view matrix multiplying the current model view with a rotation matrix. The rotation matrix is derived from the quaternion.

The quaternion is a direction vector (even not normalized) and a rotation angle. Resulted rotation is dependent on the direction vector module and the w quaternion component.

But why I should use quaternions instead of Euler axis/angle notation? The latter is simpler to visualize and to manage...

All information that I found could be synthetized with this beatifull article:

http://en.wikipedia.org/wiki/Rotation_representation

Was it helpful?

Solution

Why it is better to use quaternions is explained in the article.

  • More compact than the DCM representation and less susceptible to round-off errors
  • The quaternion elements vary continuously over the unit sphere in R4, (denoted by S3) as the orientation changes, avoiding discontinuous jumps (inherent to three-dimensional parameterizations), this is often referred to as gimbal lock.
  • Expression of the DCM in terms of quaternion parameters involves no trigonometric functions
  • It is simple to combine two individual rotations represented as quaternions using a quaternion product

OTHER TIPS

Unlike Euler angles, quaternions don't suffer from gimbal lock.

Quaternions are generally used for calculative simplicity - it's a lot easier (and faster) to do things like composing transformations when using quaternions. To quote the Wikipedia page you linked,

Combining two successive rotations, each represented by an Euler axis and angle, is not straightforward, and in fact does not satisfy the law of vector addition, which shows that finite rotations are not really vectors at all. It is best to employ the direction cosine matrix (DCM), or tensor, or quaternion notation, calculate the product, and then convert back to Euler axis and angle.

They also do not suffer from a problem common to axis/angle form, gimbal lock.

I disagree that quaternions are easier to visualize, but the main reason for using them is that it's easy to concatenate rotations without "matrix creep".

Quaternions are easier to visualize, manage and create in scenarios where you want to rotate about a particular axis that can be easily calculated. Determining a single rotation angle is much easier than decomposing a rotation into multiple angles.

Corrections to the OP: the vector represents the axis of rotation, not a direction, and the rotation component is the cosine of the half-angle, not the angle itself.

  • As mentioned, quaternions don't suffer from gimble lock.
  • For a given rotation, there is exactly one normalized quaternion representation.
    • There can be several seemingly unrelated axis/angle values that result in the same rotation.
  • Quaternion rotations can be easily combined.
    • It is extraordinarily complex to calculate an axis/angle notation that is the cumulation of two other axis/angle rotations.
  • Floating point numbers have a higher degree of accuracy when representing values between 0.0 and 1.0.

The short answer is that axis/angle notation can initially seem like the most reasonable representation, but in practice quaternions alleviate many problems that axis/angle notation presents.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top