mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +00:00
a/math: add math_matrix_2x2_transform_vec2
This commit is contained in:
parent
96fb9ce34a
commit
4840def448
|
@ -428,6 +428,17 @@ math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left,
|
||||||
const struct xrt_matrix_2x2 *right,
|
const struct xrt_matrix_2x2 *right,
|
||||||
struct xrt_matrix_2x2 *result_out);
|
struct xrt_matrix_2x2 *result_out);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Transform a vec2 by a 2x2 matrix
|
||||||
|
*
|
||||||
|
* @see xrt_matrix_2x2
|
||||||
|
* @ingroup aux_math
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
math_matrix_2x2_transform_vec2(const struct xrt_matrix_2x2 *left,
|
||||||
|
const struct xrt_vec2 *right,
|
||||||
|
struct xrt_vec2 *result_out);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Initialize a 3x3 matrix to the identity matrix
|
* Initialize a 3x3 matrix to the identity matrix
|
||||||
*
|
*
|
||||||
|
|
|
@ -456,6 +456,17 @@ math_matrix_2x2_multiply(const struct xrt_matrix_2x2 *left,
|
||||||
*result_out = result;
|
*result_out = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
math_matrix_2x2_transform_vec2(const struct xrt_matrix_2x2 *left,
|
||||||
|
const struct xrt_vec2 *right,
|
||||||
|
struct xrt_vec2 *result_out)
|
||||||
|
{
|
||||||
|
const struct xrt_matrix_2x2 l = *left;
|
||||||
|
const struct xrt_vec2 r = *right;
|
||||||
|
struct xrt_vec2 result = {l.v[0] * r.x + l.v[1] * r.y, l.v[2] * r.x + l.v[3] * r.y};
|
||||||
|
*result_out = result;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
math_matrix_3x3_identity(struct xrt_matrix_3x3 *mat)
|
math_matrix_3x3_identity(struct xrt_matrix_3x3 *mat)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue