15
\$\begingroup\$

I have been using them as a black box for a while, I'm just learning about of the maths but I'd just like some definitive answers to this question.

So far the only benefit I've come across personally is the ability to SLERP between two angles - to achieve the same effect with a vector you need quite an ugly work around (intrinsically linking 0 and 2PI together).

\$\endgroup\$
1
  • \$\begingroup\$ SLERP is not just interpolation between two angles: it can be done easily with matrix too. It can interpolate between two arbitrary orientations which is much more complex when done with matrixes. \$\endgroup\$
    – Calmarius
    Commented Nov 15, 2013 at 18:40

2 Answers 2

23
\$\begingroup\$

Quaternions solve a few problems elegantly:

  • They are as compact as axis-angle representations (4 scalar values)
  • They are easily converted to and from matrix representations
  • Interpolation works from any start to end angle without special casing
  • They never exhibit gimbal lock

You can get around these issues with other representations, but quaternions are a good fit for their algorithmic simplicity and performance.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ this is EXACTLY what I was looking for! \$\endgroup\$ Commented Feb 8, 2012 at 18:49
  • \$\begingroup\$ @Kai Interpolation works from any start to end angle without special casing, there is actually a special case, when they are not on the same hemisphere of the hypersphere, this is actually a special case that you have to consider, since there are always 2 directions to interpolate to the target and you want to pick the right one \$\endgroup\$ Commented Feb 9, 2012 at 12:11
  • 2
    \$\begingroup\$ @Kai They never exhibit gimbal lock - that is not quite true. They can, just multiply q(Xaxis, 0) * q(YAxis, 90) * q(Zaxis, 20). True is, they can be used to avoid gimbal lock, but so can matrices, axis-angles and others. So that is not a unique property of quaternions. In fact you can do that with most of the rotation representations, but euler-angles. The only true message here can be "Euler engles suffer from gimbal lock", but it can be avaoided by a lot of other rotation representations, not only quaternions. \$\endgroup\$ Commented Feb 9, 2012 at 12:19
  • 1
    \$\begingroup\$ Neither is the performance of a quaternion generally better in all cases, for instance it is faster to rotate a vector using a 3x3 matrix than using a quaternion. Here is an interesting paper about it. \$\endgroup\$ Commented Feb 9, 2012 at 14:33
3
\$\begingroup\$

The SLERP usage you mention is a specific case of a more general attribute of quaternions: you can smoothly interpolate between different rotation values.

When interpolating the rotation values of euler angles you get weird looking movements, and there just isn't logically any way to interpolate the values of axis-angle rotations (well, aside from two different angles around the same axis).

\$\endgroup\$
1
  • \$\begingroup\$ +1. One can interpolate between (w1,alpha1) and (w2, alpha2) by converting these angle-axis representations to quats and then employing SLERP. Of course, one can do such a thing via a Bezier/de Casteljau scheme/ spline scheme and use a "polygon/set" of key quaternions in such a way and come up with a complicated rotation. This is perhaps the one and only thing that quaternions do more naturally than other representations since SLERP and multiSLERP or their variations (NLERP, SQUAD) come up with intermediate rotation axis/angle pairs that lie on a geodesic/shortest rotation path. Kudos. \$\endgroup\$
    – teodron
    Commented Apr 2, 2012 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .