src/matrix2i_ptr.c file

Functions

void mat2i_identity_ptr(matrix2i* res)
Initializes the integer 2x2 matrix to identity (diagonal 1, others 0).
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_transpose_ptr(matrix2i* res, const matrix2i* m)
Computes the transpose of the input integer 2x2 matrix and stores in res.
void mat2i_inverse_ptr(matrix2i* res, const matrix2i* m)
Computes the inverse of the input integer 2x2 matrix and stores in res.
void mat2i_mul_vec2i_ptr(vector2i* res, const matrix2i* m, const vector2i* v)
Multiplies a 2x2 integer matrix by a vector2i.

Function documentation

void mat2i_identity_ptr(matrix2i* res)

Initializes the integer 2x2 matrix to identity (diagonal 1, others 0).

Parameters
res Pointer to the output matrix2i.

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.

Parameters
res Pointer to the output matrix2i.
a Pointer to the first matrix.
b Pointer to the second matrix.

void mat2i_transpose_ptr(matrix2i* res, const matrix2i* m)

Computes the transpose of the input integer 2x2 matrix and stores in res.

Parameters
res Pointer to the output matrix2i.
m Pointer to the input matrix.

void mat2i_inverse_ptr(matrix2i* res, const matrix2i* m)

Computes the inverse of the input integer 2x2 matrix and stores in res.

Parameters
res Pointer to the output matrix2i.
m Pointer to the input matrix.

Uses double precision for inversion, truncates to int; sets to identity if det=0.

void mat2i_mul_vec2i_ptr(vector2i* res, const matrix2i* m, const vector2i* v)

Multiplies a 2x2 integer matrix by a vector2i.

Parameters
res Output value.
m Input matrix.
v Input vector.