a/math: Add math_matrix_3x3_identity()

Add an initialisation function to set a 3x3 matrix
to the identity matrix.
This commit is contained in:
Jan Schmidt 2021-12-03 15:10:42 +11:00
parent 971739627a
commit bb5aa35c00
2 changed files with 15 additions and 0 deletions

View file

@ -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,

View file

@ -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,