Conversion between quaternions and Euler angles: Difference between revisions

Content deleted Content added
fixed notation for quaternion rotation matrix
Conversion formulas
Line 31:
== Conversion ==
By comparing the tems in the two matrices, we get....
 
:<math> \mathbf{q} = \begin{bmatrix}
cos_2 \phi cos_2 \theta cos_2 \psi + sin_2 \phi sin_2 \theta sin_2 \psi \\
sin_2 \phi cos_2 \theta cos_2 \psi + cos_2 \phi sin_2 \theta sin_2 \psi \\
cos_2 \phi sin_2 \theta cos_2 \psi + sin_2 \phi cos_2 \theta sin_2 \psi \\
cos_2 \phi cos_2 \theta sin_2 \psi + sin_2 \phi sin_2 \theta cos_2 \psi \\
\end{bmatrix}</math>
 
 
where <math>cos_2 \alpha</math> is a notational shortcut for <math>cos \frac{\alpha}{2}</math>, and <math>sin_2 \alpha</math> for <math>sin \frac{\alpha}{2}</math>. And for Euler angles we get:
 
:<math>\begin{bmatrix}
\phi \\ \theta \\ \psi
\end{bmatrix} =
\begin{bmatrix}
atan \frac {2(e_0 e_1 + e_2 e_3)} {1 - 2(e_1^2 + e_2^2)} \\
asin (2(e_0 e_2 - e_3 e_1)) \\
atan \frac {2(e_0 e_3 + e_1 e_2)} {1 - 2( e_2^2 + e_3^2)}
\end{bmatrix} </math>
 
=== Singularities ===
One must be aware of singularrities in the Euler angle parametrizartion when the pitch approaches <math>\pm 90^o</math> (north/south pole). These cases must be handled specially
 
{{compu-stub}}
[[Category:Abstract algebra]]
[[Category:Computer graphics]]