Quaternions demystified, part one

Let me begin with saying that, contrary to what most people seem to believe: quaternions are not hard.

The most difficult part is their name!

Imagine Hamilton (the 'inventor' of quaternions) and Euler, standing at the Origin.

They are told to go to the Light.

"That's easy", says Euler,  walks the necessary distance along the X-axis, then along the Y-axis and finally the Z-axis.

Hamilton says: "Tricky, but I can do it:" Looks at the Light and walks straight towards it until he reaches it.

Observe that Euler actually performed three 'special-case' Hamilton Translations, one after the other!

If you now imagine rotating around those translation axes, you've learned about 90% of what the difference between Euler Rotations and Quaternion Rotations is. (Still the part with the six dimensions to explain, but that's not that hard either, believe me.)

  • Kent Trammell replied

    spikeyxxx You have my attention! Because I'm one of those people that avoid quaternions for assuming their difficulty. Are you going to continue explaining these? If so I'd like to understand better why there's 4 values in quaternions vs euler's 3 values.

  • spikeyxxx replied

    There are two other parts, here: https://cgcookie.com/questions/11284-quaternions-demystified-intermezzo

    and here: https://cgcookie.com/questions/11287-quaternions-demystified-grand-finale

    I'd be happy to explain it better if there are still things you don't get.

    In a nutshell, the 4 values in a quaternion are not like the 3 values in euler.

    A quaternion is an expansion of a complex number. A quaternion called h is normally written as: h = (a + bi + cj + dk).

    (Unfortunately, in Blender and other 3D software it is written as w, x, y, z ,which make it look like coordinates in a 4 dimensional space.)

    A quaternion rotation is actually a multiplication of quaternions.

    Blender interprets the coordinates (x, y, z) of the point that needs to be rotated as a quaternion: (0 + xi + yj + zk) and than it's just a matter of multiplying (quaternion) numbers to get a 3D rotation.

    All you need to do that is a few rules: i*i = j*j = k*k = -1.

    And: i*j = k,  j*i = -k

               j*k = i, k*j = -i

    and   k*i = j, i*k = -j.



  • Kent Trammell replied

    spikeyxxx Would you want to write a guest blogpost about quaternions for our blog? That way the community would have a clear, concise explanation to reference for all time. Maybe collaborate with @waylow since he's our resident animation/maths nerd.

    Email me if you're interested! kent@cgcookie.com

  • Wayne Dixon replied

    I saw this and was thinking we need to make this move.
    I would love to collaborate with Spikey.


  • Shawn Blanch(blanchsb) replied

    spikeyxxx  I agree. I am interested in seeing some of this at work in a moving example.