I am reading Game Physics Engine Development by Ian Millington currently. In his book, he represent an orientation of rigid body by quaternion. I don't understand the formula where he apply angular velocity to the quaternion. The formula is

$$ q_{new} = q_{0} + \frac{t}{2} * w * q_{0} $$

where w is the angular velocity in quaternion representation.

$$ w = \begin{bmatrix} 0\\ w_{x}\\ w_{y}\\ w_{z} \end{bmatrix} $$

He doesn't explain where the formula come from. Currently I apply this method in my physics engine where I compute the angular rotation then convert it to quaternion and multiply it. It is slower than the above operation because of the sine, cosine and square root operation when converting the rotation to quaternion. Can someone explain to me where did the formula above come from? I understand basic quaternion operation like representing axis angle by quaternion and rotating a vector by quaternion.


In the following I use a vector hat to represent a quaternion and a unit vector hat to represent a unit quaternion.

Let q(t) represent the quaternion rotation at any point in time. Let r be a quaternion representing the rotation traveled through in the time period delta t. Then we have:

$$\hat q(0)=\hat q_0$$ and $$\hat q(\Delta t)=\hat r\hat q_0$$

If we realize that the change from time zero to time delta t is linear we can get:

$$\hat q(t)=\hat r^{t/\Delta t}\hat q_0$$

Using Euler's Formula we obtain:

$$\hat r=e^{\frac{\theta}{2}\hat u}$$

For some angle theta and axis of rotation u (Note that u has no real part and is a "pure" quaternion). This leads us to:

$$\hat r^{t/\Delta t}=exp(\frac{\theta}{2}\hat u\frac t {\Delta t})$$

Plugging this in we obtain:

$$\hat q(t)=exp(\frac{\theta}{2}\hat u\frac t {\Delta t})\hat q_0$$

Taking the derivative of both sides we obtain:

$$\hat q'=\frac {\theta \hat u} {2 \Delta t} exp(\frac{\theta}{2}\hat u\frac t {\Delta t})\hat q_0$$ $$\hat q'=\frac {\theta \hat u} {2 \Delta t}\hat q$$

If we note that: $$\frac \theta {\Delta t} = w$$

For some scalar w. This represents the magnitude of the angular velocity. The axis of rotation is the vector given by u (u has no real part).

Or we could put it more bluntly if we say that:

$$\vec w=w\hat u=w_x i+w_y j+ w_z k$$

This gives us:

$$\hat q'=\frac 1 2 \vec w \hat q$$

Now the formula that you are citing is actually not exact but only approximate......You can say for "small" delta t's that:

$$\frac {\Delta \hat {q}} {\Delta t} \approx \frac 1 2 \vec w \hat q$$

And since delta t is small we can choose any value within that time period for q, so we choose the one we already have:

$$\frac {\Delta \hat {q}} {\Delta t} \approx \frac 1 2 \vec w \hat q_{old}$$ $${\Delta \hat {q}} \approx \frac 1 2 \vec w \hat q_{old} {\Delta t}$$ $$\hat q_{new} \approx \frac 1 2 \vec w \hat q_{old} {\Delta t} + \hat q_{old}$$ $$\hat q_{new} \approx (\frac 1 2 \vec w {\Delta t} + 1)\hat q_{old}$$

The formula you link to comes from solving the differential equation and is an exact formula


I finally found a very clear derivation, here: https://fgiesen.wordpress.com/2012/08/24/quaternion-differentiation/

It's by Fabian Giesen (ryg) of demo-scene fame.

  • 1
    \$\begingroup\$ This answer would be better if it included the derivation, or at least the main points. That way even if the page you're linking to is changed, moved, or deleted in the future, others will still be able to get the information you're trying to share. \$\endgroup\$ – DMGregory Jan 10 '16 at 16:55
  • 1
    \$\begingroup\$ This question sat unanswered for months, and I found and provided the answer while attributing it to the original source. Down-voting is a bizarre reaction. \$\endgroup\$ – Jabavu Adams Jan 10 '16 at 21:18
  • 1
    \$\begingroup\$ The downvote wasn't from me (I usually wait a day or two to see if feedback has been acted on before applying a downvote unless the answer is flat-out wrong). However, you can still improve this answer by including the relevant details AND linking to the original source for attribution, rather than relying solely on the link. Downvoting link-only answers is actually fairly standard for this reason. \$\endgroup\$ – DMGregory Jan 10 '16 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.