Quaternions

Developer
Apr 15, 2007 at 7:37 PM
Not to go down the path of quaternion algebra ... interesting but not a fruitful path to follow to get out a game.

But wanted to start a discussionlist on their proper use.

I read this in "Game Physics Engine Development" by Ian Millington.
"...quaternions only represent a rotation if they have a magnitude of 1. All the operations we will be performing keep the magnitude at 1, but numerical inaccuracies and rounding erros can cause this constraint to e violated over time. Once in a whle it is a good idea to renormalize the quaternion..."

So I'm looking through Jason's balls code. Where is this renormalilzation occurring?

Millington shows a normalize() method in his C++ game engine. His web site is currently broken and all I have is old code from the CD that came with book. Surfing through this (it's enormous) I don't see the normalization happening (I'm sure it does somehow). But the point is not to understand how Millington does it, but what happens in our XNA environment. Any ideas?
Developer
Apr 15, 2007 at 7:58 PM
Oh, in the Calculate() method in RigidBodyPhysicsService() there is this code. Note the Normalize().

thing.Orientation *= Quaternion.CreateFromAxisAngle(
thing.AngularVelocity, thing.AngularVelocity.Length() * dt);
thing.Orientation.Normalize();