[Math] Coordinate Transformation of 3D Vector Using Quaternion Vector

coordinate systemsquaternionsrotationstransformation

Given a vector in a reference frame and a quaternion $\mathbf{q} = [q_x,q_y,q_z,q_w]$ that represents the rotation between my initial reference frame and my reference frame of interest:

First, where $\mathbf{q}$ is the quaternion vector that represents the rotation between the two reference frames, is the following a valid coordinate transformation between the two systems?

$$\begin{bmatrix}x' \\y' \\z' \end{bmatrix} = \begin{bmatrix}1-2q_y^2-2q_z^2 & 2q_x q_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{bmatrix}
\begin{bmatrix}x\\y\\z
\end{bmatrix}
$$

where $[x',y',z']$ is the same vector as $[x,y,z]$ represented in the reference frame rotated by $\mathbf{q}$.

Next, is there a way to perform a coordinate transformation of a 3D vector between two reference frames given a quaternion representing the rotation between the reference frames without converting the quaternion to a rotation matrix?

That is, if I have some 3D point and I want to express that same point in a coordinate system rotated by my quaternion, what is the equation to perform a coordinate transform on that point?

Best Answer

Correct, that matrix is representing the quaternion rotation.

Yes, you can perform rotations with quaternions without converting quaternions to matrices. Since you can embed your Euclidean 3D vectors into quaternion 4D linear space, just considering the $q_w=0$, you can rotate your vectors using quaternion product:

$v' = q v q^*$

Where $q^*$ is the conjugate quaternion. Then you can map back the rotated 4D vector $v'$ to the 3D space.