views:

461

answers:

6

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

+1  A: 

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.

RickNZ
+1  A: 

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.

Amber
+3  A: 

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

outis
+5  A: 

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)
  • 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
kiamlaluno
A: 

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".

Kristopher Ives
Why don't you think they're easier to visualize? What could be easier than an axis of rotation and an angle?
RickNZ
The actual representation of the quaternion when looking at the data isn't like that, compared to Euler angles which we are much more familiar with and is therefor easier to visualize when interpreting data or debugging.
Kristopher Ives
I would say quaternions are much easier to visualize, since they give you the axis of rotation in the imaginary component. When visualizing the axis of rotation of a set of euler angles, I pretty much have to perform the three euler rotations in my head, then compare the final orientation of the object with the original orientation, and maybe then I can see the single axis it rotated around.
SuperElectric
A: 
  • 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.

Shmoopty
"Axis / angle" is ambiguous in this context. Quaterions are, after all, also an axis (of rotation) and an angle (actually the cosine of the half-angle).
RickNZ