Quaternions

MarkCC has a post about quaternions and the fact that they can be used for rotation, so I thought I'd chime in with exactly how they represent rotations.

A 2D rotation by an angle θ can be represented by the complex number on the unit circle

cos θ + i sin θ

Then multiplying complex numbers is the same as multiplying rotations.

A 3D rotation by an angle θ about a line defined by a unit vector (b,c,d) can be represented by the quaternion on the unit hypersphere

cos θ/2 + sin θ/2(bi + cj + dk)

Then multiplying quaternions is the same as multiplying rotations.

But why is it θ/2 instead of θ?

Well, in 3D, in some sense you have to rotate through 720° to really get back where you started from. There's a nice animation of the Dirac Belt Trick that shows how you can remove a 720° twist from a belt without moving the ends. However, you can't remove a 360° twist. The quaternions q and -q are different but both represent the same 3D rotation.

Andrew Hanson has some demonstration programs that show how quaternions do rotations. These accompany his book Visualizing Quaternions.

Tags

More like this

Quaternions Last week, after I wrote about complex numbers, a bunch of folks wrote and said "Do quaternions next!" My basic reaction was "Huh?" I somehow managed to get by without ever being exposed to quaternions before. They're quite interesting things. The basic idea behind quaterions is: we…
When we think of numbers, our intuitive sense is to think of them in terms of quantity: counting, measuring, or comparing quantities. And that's a good intuition for real numbers. But when you start working with more advanced math, you find out that those numbers - the real numbers - are just a…
There's another way of working with number-like things that have multiple dimensions in math, which is very different from the complex number family: vectors. Vectors are much more intuitive to most people than the the complex numbers, which are built using the problematic number i. A vector is…
I showed this demo in class and I was surprised at how cool the students thought it was. They actually thought it was some kind of trick. It is not a trick. Instead, this is an example of the angular momentum principle. If you want to try this yourself, I guess you are going to have to find some…

Jack Kuipers' "Quaternions and Rotation Sequences" is also good. It's applications based, very readable and diagrammatic.

I don't think it mentions the belt trick though.

By Greg Bakker (not verified) on 08 Aug 2006 #permalink

I use quaternions in my Monte Carlo simulations of real molecular systems. For what I do they are superior to rotation matrices because of their numerical stability.

For the things I do it is necessary to have rotoinversion (improper rotation) as well. I do this by carrying along a flag in my code which tells me if this is a proper or improper rotation.

I remember asking my mate (Theoretical Physicist) about quaternions when I first looked into them and he said "What do you want with them? Noone uses them anymore ...". Heh.

Quaternions are fine, but I find that anytime you're working in SO(3) or SE(3) it involves a lot of scribbling and crumpled up paper, no matter the framework. :P

Nice article. I stumbled upon this post while looking for 3-D rotation calculations in PHP. No PHP code but a very clear explanation. So thank you. I'll make this site one of my regulars...

Iván