Question about using quaternions

Hi folks,

I’ve been struggling with how to use quaternions for rotation.

I found a boiler-plate routine that converts [x,y,z,w]
to a rotation matrix.

I had thought that by altering the angle “w” linearly,
e.g. based on the position of the mouse pointer on
the display, I could cause a linear rotation to occur
about the axis [x y z], which I’ve preset to [0 1 0].

However this has proved to be. The rotation is not linear at all.

I set w to be proportional to the mouse’s x value, and
then I normalize [x y z w].

What I observe unfortunately is that rotation slows down
toward 180 degrees in either direction.

Can anyone explain why this happens?


Only unit quaternions can be used for representing orientations.
So if you mess with one component, you will have to adjust others too.

I created a video tutorial showing how to implement quaternion rotation on my website here:

If you want to do smooth rotations have a look at SLERP