pytransform3d.rotations
.q_prod_vector#
- pytransform3d.rotations.q_prod_vector(q, v)[source]#
Apply rotation represented by a quaternion to a vector.
We use Hamilton’s quaternion multiplication.
To apply the rotation defined by a unit quaternion \(\boldsymbol{q} \in S^3\) to a vector \(\boldsymbol{v} \in \mathbb{R}^3\), we first represent the vector as a quaternion: we set the scalar part to 0 and the vector part is exactly the original vector \(\left(\begin{array}{c}0\\\boldsymbol{v}\end{array}\right) \in \mathbb{R}^4\). Then we left-multiply the quaternion and right-multiply its conjugate
\[\begin{split}\left(\begin{array}{c}0\\\boldsymbol{w}\end{array}\right) = \boldsymbol{q} \cdot \left(\begin{array}{c}0\\\boldsymbol{v}\end{array}\right) \cdot \boldsymbol{q}^*.\end{split}\]The vector part \(\boldsymbol{w}\) of the resulting quaternion is the rotated vector.
- Parameters:
- qarray-like, shape (4,)
Unit quaternion to represent rotation: (w, x, y, z)
- varray-like, shape (3,)
3d vector
- Returns:
- warray, shape (3,)
3d vector
See also
rotor_apply
The same operation with a different name.
concatenate_quaternions
Hamilton’s quaternion multiplication.