aux/math: Add quat from angle vector function

This commit is contained in:
Jakob Bornecrantz 2020-03-13 19:14:18 +00:00 committed by Jakob Bornecrantz
parent e3516061bb
commit 21e77b85d7
2 changed files with 20 additions and 0 deletions

View file

@ -113,6 +113,18 @@ math_vec3_cross(const struct xrt_vec3 *l,
*
*/
/*!
* Create a rotation from a angle in radians and a vector.
*
* @relates xrt_quat
* @relates xrt_vec3
* @ingroup aux_math
*/
void
math_quat_from_angle_vector(float angle_rads,
const struct xrt_vec3 *vector,
struct xrt_quat *result);
/*!
* Create a rotation from a 3x3 rotation matrix.
*

View file

@ -89,6 +89,14 @@ math_vec3_cross(const struct xrt_vec3 *l,
*
*/
extern "C" void
math_quat_from_angle_vector(float angle_rads,
const struct xrt_vec3 *vector,
struct xrt_quat *result)
{
map_quat(*result) = Eigen::AngleAxisf(angle_rads, copy(vector));
}
extern "C" void
math_quat_from_matrix_3x3(const struct xrt_matrix_3x3 *mat,
struct xrt_quat *result)