$$% Arcus cosine. \def\acos{\cos^{-1}} % Vector projection. \def\projection#1#2{{proj_{#1}\left(#2\right)}} % Vector rejection. \def\rejection#1#2{{rej_{#1}\left(#2\right)}} % Norm. \def\norm#1{{\left\|#1\right\|}} % Cross product. \def\cross#1#2{\mathit{cross}\left(#1,#2\right)} % Dot product. \def\dot#1#2{{#1 \cdot #2}} % Magnitude. \def\mag#1{{\left|#1\right}} \def\group#1{\left(#1\right)}} \def\sbgrp#1{\left\{#1\right\}}$$

## Axis angle to quaternion

Let $$\langle\hat{a},\alpha\rangle$$ be an axis angle representing a counter-clockwise rotation around the axis $$\hat{a}$$ by $$\alpha$$ degrees. The quaternion $$q$$ representing the same transformation is defined as

\begin{align*} q_x &= \hat{a}_x \sin\left(\alpha/2\right)\\ q_y &= \hat{a}_y \sin\left(\alpha/2\right)\\ q_z &= \hat{a}_z \sin\left(\alpha/2\right)\\ q_w &= \cos\left(\alpha/2\right) \end{align*}