Function rc_quaternion_to_rotation_matrix#

Function Documentation#

int rc_quaternion_to_rotation_matrix(rc_vector_t q, rc_matrix_t *m)#

Converts a normalized quaternion to a 3x3 orthogonal rotation matrix.

q must be normalized before calling this! The orthogonal matrix corresponds to a rotation by the unit quaternion q when post-multiplied with a column vector as such: v_rotated=mv.

If m is already 3x3 then its contents are overwritten, otherwise its existing memory is freed and new memory is allocated.

Parameters:
  • q[in] The quarter

  • m – output 3x3 rotation matrix

Returns:

Returns 0 on success or -1 on failure.