Rotation matrix and translation vector¶
A pose can also be defined by a rotation matrix and a translation vector .
The pose transformation can be applied to a point by
Conversion from rotation matrix to quaternion¶
The conversion from a rotation matrix (with ) to a quaternion can be done as follows.
The operator returns -1 if the argument is negative. Otherwise, 1 is returned. It is used to recover the sign for the square root. The function ensures that the argument of the square root function is not negative, which can happen in practice due to round-off errors.
Conversion from quaternion to rotation matrix¶
The conversion from a quaternion with to a rotation matrix can be done as follows.