diff --git a/src/xrt/auxiliary/math/m_api.h b/src/xrt/auxiliary/math/m_api.h index 923b5fac7..0506e02e9 100644 --- a/src/xrt/auxiliary/math/m_api.h +++ b/src/xrt/auxiliary/math/m_api.h @@ -318,6 +318,15 @@ math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left, const struct xrt_matrix_2x2 *right, struct xrt_matrix_2x2 *result_out); +/*! + * Initialize a 3x3 matrix to the identity matrix + * + * @see xrt_matrix_3x3 + * @ingroup aux_math + */ +void +math_matrix_3x3_identity(struct xrt_matrix_3x3 *mat); + void math_matrix_3x3_transform_vec3(const struct xrt_matrix_3x3 *left, const struct xrt_vec3 *right, diff --git a/src/xrt/auxiliary/math/m_base.cpp b/src/xrt/auxiliary/math/m_base.cpp index c5dd83ddb..4c04d4bfd 100644 --- a/src/xrt/auxiliary/math/m_base.cpp +++ b/src/xrt/auxiliary/math/m_base.cpp @@ -364,6 +364,12 @@ math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left, *result_out = result; } +extern "C" void +math_matrix_3x3_identity(struct xrt_matrix_3x3 *mat) +{ + mat->v[0] = mat->v[4] = mat->v[8] = 1.0; +} + extern "C" void math_matrix_3x3_transform_vec3(const struct xrt_matrix_3x3 *left, const struct xrt_vec3 *right,