Conversion between quaternions and Euler angles: Difference between revisions

Content deleted Content added
Tag: Reverted
Link suggestions feature: 3 links added.
 
(One intermediate revision by one other user not shown)
Line 20:
:<math>\mathbf{q}_y = \sin(\alpha/2)\cos(\beta_y)</math>
:<math>\mathbf{q}_z = \sin(\alpha/2)\cos(\beta_z)</math>
where α is a simple rotation angle (the value in radians of the [[angle of rotation]]) and cos(β<sub>''x''</sub>), cos(β<sub>''y''</sub>) and cos(β<sub>''z''</sub>) are the "[[direction cosine]]s" of the angles between the three coordinate axes and the axis of rotation. ([[Euler's rotation theorem|Euler's Rotation Theorem]]).
 
==Intuition==
Line 70:
 
== Rotation matrices ==
The [[orthogonal matrix]] (post-multiplying a [[Row and column vectors|column vector]]) corresponding to a clockwise/[[Right-hand rule|left-handed]] (looking along positive axis to origin) rotation by the unit [[quaternion]] <math>q=q_w+iq_x+jq_y+kq_z</math> is given by the [[Quaternions and spatial rotation#Quaternion-derived rotation matrix|inhomogeneous expression]]:
 
:<math>R = \begin{bmatrix}
Line 267:
:<math>\vec{t} = 2\vec{q} \times \vec{v}</math>
:<math>\vec{v}^{\,\prime} = \vec{v} + q_w \vec{t} + \vec{q} \times \vec{t}</math>
where <math>\times</math> indicates a three-dimensional vector [[cross product]]. This involves fewer multiplications and is therefore computationally faster. Numerical tests indicate this latter approach may be up to 30% <ref>{{cite journal |pmc=4435132|year=2015|last1=Janota|first1=A|title=Improving the Precision and Speed of Euler Angles Computation from Low-Cost Rotation Sensor Data|journal=Sensors|volume=15|issue=3|pages=7016–7039|last2=Šimák|first2=V|last3=Nemec|first3=D|last4=Hrbček|first4=J|doi=10.3390/s150307016|pmid=25806874|bibcode=2015Senso..15.7016J |doi-access=free}}</ref> faster than the original for vector rotation.
 
=== Proof ===
Line 300:
:<math>
\begin{align}
\mathbf{v}^\prime & = \mathbf{q v q^\ast} = (0, (q_w^2 - \vec{q}\cdot\vec{q})\vec{v} + 2 q_w \vec{q} \times \vec{v} +
2\vec{q}\times (\vec{q}\times\vec{v} )) \\
\end{align}
Line 306:
which upon defining <math>\vec{t} = 2\vec{q} \times \vec{v}</math> can be written in terms of scalar and vector parts as
:<math>
(0, \vec{v}^{\,\prime}) = (0, (q_w^2 - \vec{q}\cdot\vec{q})\vec{v} + q_w \vec{t} + \vec{q} \times \vec{t} ).
</math>