Sign in to follow this  
mv348

updating quaternions by angles / angular velocity

Recommended Posts

Okay. So I believe I understand the basics of quaternions pretty well.

An orientation produced by rotation about the axis given by a unit vector (x,y,z), and by an angle a, can be represented by the quaternion Q given by:

Q = [ cos(a/2), x sin(a/2), y sin(a/2), z sin(a/2)]

Then differentating both sides with respect to time t gives:

dQ/dt = [-sin(a/2),x cos(a/2), y cos(a/2), z cos(a/2)](1/2) (da/dt)

Let w be the angular velocity, w = (da/dt).

This gives us an update equation for the quaternion for a small time differential dt:

Q2=Q1+ [-sin(a/2),x cos(a/2), y cos(a/2), z cos(a/2)](1/2) w dt

It just so happens that quaternion multiplication (and ||(x,y,z)||=1) immediately gives [ 0,x,y,z]*[cos(a/2), x sin(a/2, y sin(a/2), z sin(a/2)]= [-sin(a/2), x cos(a/2), y cos(a/2), z cos(a/2)]=[0,x,y,z] Q1

So we can substitute for the derivative quaternion, and combine [0,x,y,z] and w to get:

Q2=Q1+ (1/2) [0,w*x, w*y, w*z] Q1dt

So we can uptate based on an axis-angle vector (in quaternion form) and the time differential dt.

OKAY! All that makes total sense, though my book just stated the final formula without explanation.

The next part is where I am confused. They state that in some circumstances you want to "rotate" a quaternion by a given ammount (given by axis angle representation [ (da)x, (da) y, (da) z]. Where (da) is the change in angle, as before)

They use a similar update equation:

Q2=Q1+ (1/2) [0,(da)x, (da)y, (da)z] Q1

This makes some sense because w dt = (da/dt)dt = da. However, since this was based on differentation, it should really only hold true for a very small da. But my book presents it as if it can be used to rotate by any change in angle.
How could this be the case?

The second issue I have with this, is that even assuming its true, the book states that the latter update equation can be implemented as follows: ( I added some comments for clarification)

[code]class Quaternion
{
// other quaternion code

void rotateByVector(const Vector3& vector)
{
// vector gives axis angle form of rotation
Quaternion q(0,vector.x,vector.y,vector.z);
(*this)*= q; // using overloaded quaternion operator

}
}
[/code]

This update looks nothing at all like the update equation they described. There is no addition of quaternions and there is no (1/2) scaler present.

My only guess was that maybe this actually computes dQ = 1/2 [0,(da)x, (da)y, (da)z] Q1 and ignores the scaling by (1/2) because the quaternion would later be normalized. But I'm really not satisfied with this explanation..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this