I am observing the rotation of a box. While the rotation is continuous, I've captured the following three quaternions $q_0, q_1, q_2$ to understand its rotation:

\begin{equation} q = [s, x \boldsymbol{i} + y \boldsymbol{j} + z \boldsymbol{k}] \quad s,x,y,z \in \mathbb{R} \end{equation}

\begin{equation} q_0 = \lbrack 0.67156, - 0.018402 \boldsymbol{i} - 0.74072 \boldsymbol{j} - 0.0025122 \boldsymbol{k} \rbrack; \\ q_1 = \lbrack 0.22424, - 0.103290 \boldsymbol{i} - 0.96833 \boldsymbol{j} + 0.0371360 \boldsymbol{k} \rbrack; \\ q_2 = \lbrack 0.25635, + 0.228900 \boldsymbol{i} + 0.93650 \boldsymbol{j} - 0.0696340 \boldsymbol{k} \rbrack; \\ \end{equation}

Visually observing the box, I can tell it is stationary at $q_0$. It is rotated by $\approx 80^{\circ}$ when it arrives to $q_1$. The same is true during rotation from $q_1$ to $q_2$. The total visual change in rotation from $q_0$ to $q_2$ is $\approx 160^{\circ}$ on one axis. I am not sure which axis that is. Consider the below illustration as an example:

holding a box

At $q_0$, the side of the box that is labeled as $3$ is facing on the ground, and $1$ is facing the sky. At $q_2$, $3$ is now facing predominantly at the sky and $1$ is facing the ground.

GOAL: What I want to do is calculate the change in rotation for each axis to see where the rotation is occurring and how close it comes to my visual interpretation ( is it $160^{\circ}$ ?).

I start by defining a quaternion, $q_s = [1, 0 \boldsymbol{i} + 0\boldsymbol{j} + 0\boldsymbol{k}]$, that is an arbitrary rotation from which I can measure change. I then begin normalizing my axis one at a time. For my first iteration, I focus on the x-axis:

\begin{equation} q^\prime = \frac{q}{ \sqrt{s^2 + x^2} } \end{equation}

Completing this step, I have the following unit quaternions and their conjugates:

\begin{equation} q_{0}^\prime = \lbrack 0.99962, - 0.027391 \boldsymbol{i} - 0 \boldsymbol{j} + 0 \boldsymbol{k} \rbrack; \\ q_{1}^\prime = \lbrack 0.90827, - 0.41838i \boldsymbol{i} - 0 \boldsymbol{j} + 0 \boldsymbol{k} \rbrack; \\ q_{2}^\prime = \lbrack 0.74591, + 0.66604 \boldsymbol{i} + 0 \boldsymbol{j} - 0 \boldsymbol{k} \rbrack; \\ \end{equation}

\begin{equation} q_{0}^* = \lbrack 0.99962, + 0.027391 \boldsymbol{i} + 0 \boldsymbol{j} + 0 \boldsymbol{k} \rbrack; \\ q_{1}^* = \lbrack 0.90827, + 0.418380 \boldsymbol{i} + 0 \boldsymbol{j} + 0 \boldsymbol{k} \rbrack; \\ q_{2}^* = \lbrack 0.74591, - 0.666040 \boldsymbol{i} + 0 \boldsymbol{j} + 0 \boldsymbol{k} \rbrack; \\ \end{equation}

To measure the rotation, I take the product of $q_s$ and $q_{n}^*$, $z$. The angle of change is $2 * acosd(z_s)$. I repeat this process for each axis, and below are my results:

x-axis: $3.1392^{\circ}, 49.4649^{\circ}, 83.5249^{\circ}$

y-axis: $95.6076^{\circ}, 153.9234^{\circ}, 149.3828^{\circ}$

z-axis: $0.42868^{\circ}, 18.8066^{\circ}, 30.3938^{\circ}$

None of the answers seem correct and I suspect I am doing something wrong. It is rather odd that every angle on the x-axis is about $\frac{1}{2}$ of the rotation. What must I correct to be able to achieve my GOAL?

My sources to get this far:

Quaternions for Computer Graphics 2011th Edition by John Vince


Compute Angle Between Quaternions (in Matlab)


1 Answer 1


If your goal is to determine what axis your rotation is occurring about, the good news is that there's a much simpler answer than what you're trying to put together; in fact, this is a large part of why quaternions are used! Specifically, the rotation that carries the orientation represented by $q_0$ to the one represented by $q_2$ is just $q_2q_0^{-1}$. And if a quaternion is given by $a+b\mathbf{i}+c\mathbf{j}+d\mathbf{k}$, the axis of rotation is just (the normalized version of) $\langle b, c, d\rangle$, and the amount of rotation is $2 \arccos(a)$, assuming that the original quaternion is normalized.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .