0
$\begingroup$

Consider a situation where a beam is shot at a cube C from an arbitrary position P. The cube detects the angle of incidence relative to its $ x $ axis. The cube can be rotated and moved, and the orientation (rotation) of the cube is being tracked.

Below is an example in two dimensions. In the reference orientation, $ C_\text{ref} $, the angle of incidence is $ 0° $. The cube is then moved to an arbitrary position and rotated with an arbitrary quaternion rotation $ \mathbf{q} $. The measured angle of incidence is now $ \gamma $. By subtracting the rotation angle $ \beta $, the angle of incidence relative to the reference orientation is found to be $ \alpha $. ($ \alpha = \gamma - \beta $) In three dimensions, the same problem would also have an elevation angle.

enter image description here

My question is this: how do I convert the (three-dimensional) rotation from quaternions $ \mathbf{q}=(q_0,q_1,q_2,q_3) $ to spherical angles $ (\theta,\phi) $?

$\endgroup$
0
$\begingroup$

Any rotation in three-dimensions can be represented as a rotation by an angle $\theta$ about an axis determined by a unit vector $\hat{n}=(n_1,n_2,n_3)$ -- that is three parameters and not two as the OP indicates. Such a rotation can be represented by $$ \exp(\theta\ \sum_{j=1}^3 n_j \cdot T^j)\ , $$ where $(T^1,T^2,T^3)$ are a basis in the fundamental (three) representation of $so(3)$ and are given by the matrices $(T_{i})_{jk}=\epsilon_{ijk}$. The connection with quaternions that I know makes use of the isomorphism of the (complex) Lie algebras $so(3)$ and $su(2)$. We just replace $\mathbf{T}$ with the corresponding generators in the fundamental (two) dimensional representation of $su(2)$. A basis for this Lie algebra are given in terms of the Pauli matrices. Using the identification $$T^j \longleftrightarrow i\sigma^j/2\ ,$$ one obtains $$ \exp(\theta\ \sum_{j=1}^3n_j \tfrac{i\ \sigma^j}2)= \cos \tfrac{\theta}2 \mathbf{1} + i \sin \tfrac\theta2 \sum_{j=1}^3 n_j\ \sigma^j $$ where I have used a standard identity involving Pauli matrices. The right hand side is a quaternion, if you wish. Note that this is not a 1-1 map as group manifold of $SU(2)$ is a double cover of $SO(3)$.

$\endgroup$
  • $\begingroup$ Thanks for the reply. This doesn't seem to be a conversion into spherical angles (azimuth and elevation), though. Could you please explain how to obtain the azimuth and elevation? $\endgroup$ – eiterorm Jul 20 '14 at 23:17
  • $\begingroup$ Also, I didn't quite understand what you meant by "that is three parameters and not two as the OP indicates". Have I somehow indicated a two-dimensional vector? The two-dimensional situation was just a simplified example to prevent a cluttered illustration. $\endgroup$ – eiterorm Jul 20 '14 at 23:18
  • $\begingroup$ The three parameters that parametrise a three-dimensional rotation are the angle $\theta$ and the two parameters that specify a unit vector $\hat{n}$. You should be able to work out the change of variables from this to azimuth and elevation. $\endgroup$ – suresh Jul 21 '14 at 0:21
  • $\begingroup$ I'm still not sure how to do this. I could convert it via the roll, pitch and yaw angles, but this approach has issues for certain angles. I'm looking for a solution without such issues. Could you please help me? $\endgroup$ – eiterorm Jul 21 '14 at 8:18

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.