Quaternions

$\textbf{q} = xi + yj + zk + w $ Quaternion rep; i,j,k imaginary values, w is scalar val
$\textbf{q} = \textbf{v} + s $ alt rep. v = xyz, s = w scalar
$\textbf{q} = (sin \frac{\theta}{2})\textbf{a} + cos\frac{\theta}{2}$ rep. where rotation of $\theta$ about axis a
$\textbf{q}_1\textbf{q}_2 = \textbf{v}_1 \times \textbf{v}_2 + s_1 \textbf{v}_2 + s_2 \textbf{v}_1 + s_1 s_2 - \textbf{v}_1 \cdot \textbf{v}_2
$ Quaternion multiplication
$\textbf{q}_2\textbf{q}_1 = \textbf{q}_1\textbf{q}_2 - 2(\textbf{v}_1 \times \textbf{v}_2) $ Order of multiplication property
$\textbf{q}^* = -\textbf{v} + s $ Quaternion conjugate
$\textbf{q}\textbf{q}^* = \textbf{q}^*\textbf{q} = v^2 + s^2 $ Conjugate multiply
$\vert\vert\textbf{q}\vert\vert = \sqrt{\textbf{q}\textbf{q}^*} = \sqrt{v^2 + s^2} $ Quaternion magnitude
$\textbf{q}^{-1} = \frac{\textbf{q}^*}{\textbf{q}\textbf{q}^*} = \frac{-\textbf{v} + s}{v^2 + s^2}$ Quaternion inverse
$\textbf{v}^\lq = \textbf{q} \textbf{v} \textbf{q}^{-1}$ Vector rotation using quaternion (uses quat. mult.) v is quaternion of form $v_x i + v_y j + v_z k + 0$.
$\textbf{v}^\lq = \textbf{q} \textbf{v} \textbf{q}^*$ Vector rotation using quaternion if quat is unit (magnitude = 1)
$\textbf{v}^\lq = (\textbf{q}_2\textbf{q}_1)\textbf{v}(\textbf{q}_2\textbf{q}_1)^*$ Multiple rotations combined
$\textbf{M}_{rot}(\textbf{q}) = \begin{bmatrix}
1 - 2y^2 - 2z^2 & 2(xy -wz) & 2...
...z^2 & 2(yz -wx) \\
2(xz - wy) & 2(yz + wx) & 1 - 2x^2 - 2y^2
\end{bmatrix}
$ Convert quaternion to rotation matrix