46 .m11 = m->
v[0], .m21 = m->
v[2],
47 .m12 = m->
v[1], .m22 = m->
v[3]
69 .m11 = m->
v[3] * inv_det, .m21 = -m->
v[1] * inv_det,
70 .m12 = -m->
v[2] * inv_det, .m22 = m->
v[0] * inv_det
85 res->
x = m->
m11 * x + m->
m12 * y;
86 res->
y = m->
m21 * x + m->
m22 * y;
103 .m11 = cos_theta, .m21 = sin_theta,
104 .m12 = -sin_theta, .m22 = cos_theta
117 .m11 = s->
x, .m21 = 0.0f,
118 .m12 = 0.0f, .m22 = s->
y
131 .m11 = m->
m11, .m21 = m->
m21,
132 .m12 = m->
m12, .m22 = m->
m22
void mat2_scale_ptr(matrix2 *res, const vector2 *s)
Builds a 2x2 scaling matrix from a vector2.
void mat2_mul_ptr(matrix2 *res, const matrix2 *a, const matrix2 *b)
Multiplies two 2x2 matrices (a * b) in column-major / column-vector convention.
void mat2_transpose_ptr(matrix2 *res, const matrix2 *m)
Computes the transpose of the input 2x2 matrix and stores in res.
void mat2_identity_ptr(matrix2 *res)
Initializes the 2x2 matrix to identity (diagonal 1.0, others 0.0).
void mat2_inverse_ptr(matrix2 *res, const matrix2 *m)
Computes the inverse of the input 2x2 matrix using determinant and stores in res.
void mat2_rotation_z_ptr(matrix2 *res, const vm_float_t degrees)
Sets res to a 2x2 rotation matrix for rotation around the Z-axis.
void mat2_mul_vec2_ptr(vector2 *res, const matrix2 *m, const vector2 *v)
Multiplies a 2x2 matrix by a vector2.
void mat2_from_mat3_ptr(matrix2 *res, const matrix3 *m)
Copies the upper-left 2x2 of a matrix3.
vm_float_t v[VECMAT_MAT2_SIZE]
vm_float_t deg_to_rad(vm_float_t degrees)
Converts degrees to radians.
vm_float_t mat2_determinant(matrix2 m)
Calculates the determinant of the given 2x2 matrix.