47 .m11 = m->
v[0], .m21 = m->
v[2],
48 .m12 = m->
v[1], .m22 = m->
v[3]
67 const double inv_det = 1.0 / (double)det;
69 .m11 = (int)(m->
v[3] * inv_det), .m21 = (int)(-m->
v[1] * inv_det),
70 .m12 = (int)(-m->
v[2] * inv_det), .m22 = (int)(m->
v[0] * inv_det)
85 res->
x = m->
m11 * x + m->
m12 * y;
86 res->
y = m->
m21 * x + m->
m22 * y;
void mat2i_transpose_ptr(matrix2i *res, const matrix2i *m)
Computes the transpose of the input integer 2x2 matrix and stores in res.
void mat2i_mul_ptr(matrix2i *res, const matrix2i *a, const matrix2i *b)
Multiplies two integer 2x2 matrices (a * b) using explicit loops and stores the result in res.
void mat2i_mul_vec2i_ptr(vector2i *res, const matrix2i *m, const vector2i *v)
Multiplies a 2x2 integer matrix by a vector2i.
void mat2i_inverse_ptr(matrix2i *res, const matrix2i *m)
Computes the inverse of the input integer 2x2 matrix and stores in res.
void mat2i_identity_ptr(matrix2i *res)
Initializes the integer 2x2 matrix to identity (diagonal 1, others 0).
vm_int_t v[VECMAT_MAT2_SIZE]
vm_int_t mat2i_determinant(matrix2i m)
Calculates the determinant of the given 2x2 integer matrix.