This topic is now archived and is closed to further replies.


Quaternions as rotations

Recommended Posts

BigBadBob    145
Hope someone can help with this. I am reading about quaternions being used as rotations in 3D space. Lets say I have a quaternion q (where q = s + v, s being the scalar part and v the 3 dimensional vector), and a point P in 3D space. The text I am reading says that apply q to P as qP yields the following: ((-v.P) + sP + (v x P)) [ where ''.'' indicates dot product and ''x'' indicates cross product] Can someone explain this. I can see how the term sP arrives but as for the cross and dot product I am not sure. Is it that multiplication of two vectors is vP = v x P - v.P ?? I would have though that multiplying the two vectors would have just used the cross product. Thanks for any help you can give.

Share this post

Link to post
Share on other sites
kdogg    204
quaternion multiplication is defined as:

[s1, v1] * [s2, v2] =[s1*s2 - v1.v2, s1*v2 + s2*v1 + v1Xv2]

where '*' means scalar multiplication, '.' means dot product, and 'X' means cross product.

The inverse of a quaternion is defined as:

q-1 = (1/||q||)2 * [s, -v]

where ||q|| = sqrt(s2 + x2 + y2 + z2)

To rotate a vector, v, represent v as [0, v].
v' = q * v * q-1

The represenation of a rotation of theta degrees around the an axis of rotation (x, y, z) is:

q = [cos(theta/2), sin(theta/s)*(x, y, z)]

Given a unit quaternion [s, x, y, z] the corresponding 4 dimensional rotation matrix looks like this:

[ 1-2y^2-2z^2 2xy-2sz 2xz+2sy 0 ]
[ 2xy+2sz 1-2x^2-2z^2 2yz-2sx 0 ]
[ 2xy-2sy 2yz+2sx 1-2x^2-2y^2 0 ]
[ 0 0 0 1 ]

(the spacing was messed up without the source tags)

These are just definitions and i don't entirely know what the derivation is in all cases, but they work. I actually think the definition of multiplication makes sense in a way, and all the other formulas are more or less derived from that.

[edited by - kdogg on March 17, 2003 1:33:53 AM]

Share this post

Link to post
Share on other sites