[ODE] Simulator explodes on zero Quaternion normalisation

Olivier Parisy parisy at labri.fr
Wed Jun 2 14:18:07 MST 2004


George Birbilis wrote:
> you can consider a quaternion to be a 3d vector of length 1, representing an
> axis in space (starting from (0,0,0) obviously), plus an angle (rotation)
> arround that axis. So in effect a quaternion is a custom rotation (instead
> of giving Euler angles or rotations arround X,Y,Z axis [in which case the
> order of rotation X,Y,Z, or Z,Y,X or Y,Z,X etc. is important])
> 
> hope I remember it OK.

More precisely, you can convert a normalized axis "n" and an angle "a",
as you describe them, to a quaternion q=(v,w) in this way :

q = (v,w) = (sin(a/2).n, cos(a/2))

So note that, by definition,  a quaternion representing a rotation has
a unit length (v²+w²=1).

 > I think you shouldn't use dNormalize4, cause it will
> normalize the angle too. You should normalize the first 3 components (X,Y,Z)
> of the quaternion, since the 4th is in radians the rotations arround the
> X,Y,Z axis that the quaternion defines. Try calling dNormalize3 on the
> quaternion pointer or some normalize func made for quaternions (search the
> ODE math libs)

I don't agree : because of the above property, you need to renormalize
the four components of a quaternion (those will drift because of
numerical imprecision). Normalizing the v=(x,y,z) components will,
generally speaking, lead to a non-unit quaternion which doesn't
represent a rotation.

Regards,
Olivier.


More information about the ODE mailing list