Do me a favor, take a few seconds to have a look at my last project.

Thank you, Lulu

# Quaternion to rotation matrix

Let's consider the following quaternion:

$$Q= \left[ \begin{matrix} q_w && q_x && q_y && q_z \end{matrix} \right]$$

The equivalent matrix, which represents the same rotation, is:

$$M = \left[ \begin{matrix} 1 - 2q_y^2 - 2q_z^2 && 2q_xq_y - 2q_zq_w && 2q_xq_z + 2q_yq_w \\ 2q_xq_y + 2q_zq_w && 1 - 2q_x^2 - 2q_z^2 && 2q_yq_z - 2q_xq_w \\ 2q_xq_z - 2q_yq_w && 2q_yq_z + 2q_xq_w && 1 - 2q_x^2 - 2q_y^2 \end{matrix} \right]$$