How can I transform coordinate systems with quaternions?

7.9k Views Asked by At

I have a coordinate system $0$ which I'd first like to rotate about its $z$-axis which gives me system $1$, and afterwards rotate system $1$ about its $y$-axis which gives me system $2$. See picture: enter image description here

Both rotation angles are $90^{\circ}$ and shall be realized with quaternions $q_1$ (first rotation) and $q_2$ (second rotation). So I have \begin{align} q_1=\left(\cos\left(\frac{1}{2}\frac{\pi}{2}\right),0,0,\sin\left(\frac{1}{2}\frac{\pi}{2}\right)\right) \newline q_2=\left(\cos\left(\frac{1}{2}\frac{\pi}{2}\right),0,\sin\left(\frac{1}{2}\frac{\pi}{2}\right),0\right) \end{align} Let's take only the $x_0$-axis for now whicht is $x_0=(1,0,0)$. I'd like to express every new coordinate axis of system 1 and 2 in the 0-system. \begin{align} x_1=q_1\cdot x_0 \cdot q_1^{-1} = (0,1,0) \end{align} is fine. But with the next transformation I'm in trouble, as it returns \begin{align} x_2=q_2\cdot x_1 \cdot q_2^{-1} = (0,1,0) \end{align} which is logical because a rotation of the y-axis around the y-axis has no effect. But also \begin{align} x_2=q_2\cdot q_1 \cdot x_1 \cdot q_1^{-1} \cdot q_2^{-1} = (0,0,1) \end{align} or \begin{align} x_2=q_2\cdot q_1 \cdot x_0 \cdot q_1^{-1} \cdot q_2^{-1} = (0,1,0) \end{align} is wrong, as it should be $x_2=(0,0,-1)$, shouldn't it?

Is there anything essential I've missed studying quaternions, and could anybody get this right for me please? Thank you very much!

1

There are 1 best solutions below

0
On

Ok I got it by my own... it's just the same way like transforming with matrices. $x_2$ has to be multiplied first with $q_2$ and then with $q_1$ to express it in the 0-system! That's it!