aux/math: Implement math_matrix_2x2_multiply.

This commit is contained in:
Lubosz Sarnecki 2020-11-27 16:45:51 +01:00
parent f6839ee4bf
commit bd68c0e5f5
2 changed files with 22 additions and 0 deletions

View file

@ -300,6 +300,17 @@ math_quat_rotate_derivative(const struct xrt_quat *rot,
* *
*/ */
/*!
* Multiply Matrix2x2.
*
* @relates xrt_matrix_2x2
* @ingroup aux_math
*/
void
math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left,
const struct xrt_matrix_2x2 *right,
struct xrt_matrix_2x2 *result);
void void
math_matrix_3x3_transform_vec3(const struct xrt_matrix_3x3 *left, math_matrix_3x3_transform_vec3(const struct xrt_matrix_3x3 *left,
const struct xrt_vec3 *right, const struct xrt_vec3 *right,

View file

@ -293,6 +293,17 @@ math_quat_rotate_derivative(const struct xrt_quat *quat,
* *
*/ */
void
math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left,
const struct xrt_matrix_2x2 *right,
struct xrt_matrix_2x2 *result)
{
result->v[0] = left->v[0] * right->v[0] + left->v[1] * right->v[2];
result->v[1] = left->v[0] * right->v[1] + left->v[1] * right->v[3];
result->v[2] = left->v[2] * right->v[0] + left->v[3] * right->v[2];
result->v[3] = left->v[2] * right->v[1] + left->v[3] * right->v[3];
}
extern "C" void extern "C" void
math_matrix_3x3_transform_vec3(const struct xrt_matrix_3x3 *left, math_matrix_3x3_transform_vec3(const struct xrt_matrix_3x3 *left,
const struct xrt_vec3 *right, const struct xrt_vec3 *right,