1
$\begingroup$

PRZEMYSLAW DOBROWOLSKI has written a paper that (I think) can be applied to swing-twist decompositions for quaternion rotations called "SWING-TWIST DECOMPOSITION IN CLIFFORD ALGEBRA" .

I tried to apply Algorithm 1 in the paper to this simple scenario: I want to calculate the angle between the world z-axis and the body z-axis from the body rotation given as a quaternion.

I therefore set

$v = 0 \mathbf{e}_1 + 0 \mathbf{e}_2 + 1 \mathbf{e}_3\\ q= a + b \mathbf{e}_{12} + c \mathbf{e}_{23} + d \mathbf{e}_{31}$

applying the algorithm, I get the following intermediate variables

$u = b,\; n = 1,\; m = a,\; l = \sqrt{a^2 + b^2}$

from those, I can calculate the twist $q$ and the swing $p$ as

$q = \frac{m}{l} + \frac{u}{l} \mathbf{e}_{12} = \frac{a^2}{\sqrt{a^2 + b^2}} + \frac{b^2}{\sqrt{a^2 + b^2}} \mathbf{e}_{12} \\ p = s\tilde{q} = s \left( \frac{a^2}{\sqrt{a^2 + b^2}} - \frac{b^2}{\sqrt{a^2 + b^2}} \mathbf{e}_{12} \right) = \underbrace{\frac{a^2 + b^2}{\sqrt{a^2 +b^2}}}_w + \dots$

Where I only wrote down the real part of the resulting swing quaternion $p$ because this already determines the swing angle by $w = cos(\theta/2)$.

But this doesn't make alot of sense to me, because the solution does not depend on $c$ and $d$, which it should, considering the euler rotation interpretation of the quaternion.

Also, using this paper, I was able to derive a different solution, namely

$$ \theta = \cos^{-1} \left( a^2 - b^2 - c^2 + d^2 \right) $$

which actually, looking at a few numeric values, gives the correct result.

I'm now wondering what I misunderstood about the first paper. Shouldn't I obtain the same results?

$\endgroup$

1 Answer 1

1
$\begingroup$

The first paper is about the general decomposition of a spinor (or a quaternion, via a simple isomorphism), whereas the actual question is about, much simpler question about the angle between the two vectors. Formula given to calculate an angle is indeed correct - it's the arc cosine of a dot product between the initial vector $v$ and final vector $v'$. In this case final vector can be simply obtained by rotating vecotr $v$ by $q$: $$v' = q v q^*$$ Going back to the first article - Algorithm 1: It says that given an arbitrary spinor (or a quaternion) and some unit direction, it will decompose a rotation acting on the given unit vector into a part which "twists" and a part that swings (no rotation around axis). For instance, it is useful if one needs to check how much twist is applied when some skeletal animation is calculated. Such twist can be then reduced and recombined with the previous swing to obtain an animation which doesn't twist so much.

And finally, the isomorphism between quaternions and spinors in three dimensions is: $$i = −e_{23}, j = −e_{31}, k = −e_{12}$$ I should be applied before Alg.1 and after Alg.1 or formulas can be changed so that they work for quaternions directly.

$\endgroup$
1
  • $\begingroup$ I see, i probably erred in my calculations by using $$i = e_{13}, j = e_{23}, k = e_{31}$$. $\endgroup$
    – Xaser
    Jul 11, 2017 at 10:19

You must log in to answer this question.

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