PDA

View Full Version : Quaternion Rotation



maedhros777
06-17-2010, 12:33 PM
Hi, I'm pretty new to quaternions and I've been reading Game Programming Gems (http://www.amazon.com/GAME-PROGRAMMING-GEMS-Mark-DeLoura/dp/1584500492). One of the sections is an introduction to quaternions, and it's established that if quaternion q represents a rotation of angle a around vector A, q = (cos(a/2), sin(a/2) * A). It also says that the result of vector p's rotation in such a manner is equal to qpq*, where q is normalized and q* is q's conjugate.

The book skips the explanation of why this works, but says "consider rotating the vector P by an angle a; about an axis A. Using geometry, you can work through the math, expanding everything out until eventually some terms in cos^2(a) and sin^2(a) turn up. These can be turned into cos(2a) and sin(2a) terms, and very soon you end up with a formula that looks a lot like the quaternion multiplication worked through previously."

Can anyone please explain how this property of quaternions can be proved? Because I've tried looking at the problem in various ways and I've never come up with anything involving cos^2(a) or sin^2(a), or any other reasoning, for that matter. Thank you for your help, in advance.

EDIT: I changed all the theta symbols to a, because the forum wasn't displaying it correctly.

Rosario Leonardi
06-18-2010, 04:53 AM
Read this:
http://www.itu.dk/people/erikdam/DOWNLOAD/98-5.pdf
Page 24, preposition 21.

If it's not clear ask again, I'll try to explain it.

nickels
06-18-2010, 12:45 PM
David Eberly's game physics book has two or three derivations of the rotation property.

Honestly, I worked through one of them, and believe it. However, what it boils down to for me is just 'algebraically quaternion conjugation and rotation matrices have the same action'! No stunning intuition, no insights into the nature of the universe (for me).

He has another derivation that develops i,j,k of the quaternions as simple rotation generators which, I believe, might offer a better insight and intuition. I haven't worked through it, but you might ???

Another resource is wikipedia:
wiki quaternion (http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation)
where the corresponence is proved.

maedhros777
06-18-2010, 03:36 PM
Thanks for your answers -- I looked at the pdf that Rosario Leonardi linked to, and I've found the proof very helpful. I just have a couple of questions, though: on page 25, the author says that "(Rr)_|_ = r_|_ * cos(theta) + v * sin(theta)" (sorry if my attempt at a perpendicular symbol looks weird :D). Why is that? Also, in page 26, the proof uses the identity "v_1 x (v_2 x v_3) = (v_1 * v_3)v_2 - (v_1 * v_2)v_3". If you could explain the answers to either of these questions, or give a link to where an answer might be found, that would be great.

Rosario Leonardi
06-20-2010, 02:17 PM
The first part show how we can find the rotation in the standard way (without quaternion).
To show this let's decompose R in the parallel and perpendicular part as regard n.
If I rotate around n the parallel part don't change. The perpendicular part will rotate into a plane formed by R_|_ and V.

P = Px cos(theta) + Py sin(theta) is the standard way to rotate a point on a plane.


A X (B X C) = (A*C)*B-(A*B)*C
is the triple product (or Lagrange formula)
http://en.wikipedia.org/wiki/Triple_product#Vector_triple_product

maedhros777
06-20-2010, 07:06 PM
Ok, I think I understand it now. Thanks for all your help, and for the links.