Vecmat 0.2.3
C math and linear algebra library for 2D/3D graphics, physics, and science.
Loading...
Searching...
No Matches
matrix3i_ptr.c File Reference
#include <vecmat.h>

Go to the source code of this file.

Functions

void mat3i_identity_ptr (matrix3i *res)
 Fills the given 3x3 integer matrix with the identity matrix.
void mat3i_mul_ptr (matrix3i *res, const matrix3i *a, const matrix3i *b)
 Multiplies two 3x3 integer matrices (standard matrix multiplication).
void mat3i_transpose_ptr (matrix3i *res, const matrix3i *m)
 Computes the transpose of a 3x3 integer matrix.
void mat3i_inverse_ptr (matrix3i *res, const matrix3i *m)
 Computes the inverse of a 3x3 integer matrix using adjugate over determinant.
void mat3i_mul_vec3i_ptr (vector3i *res, const matrix3i *m, const vector3i *v)
 Multiplies a 3x3 integer matrix by a vector3i.
void mat3i_mul_vec2i_ptr (vector2i *res, const matrix3i *m, const vector2i *v)
 Applies a 3x3 integer affine transform to a vector2i.

Function Documentation

◆ mat3i_identity_ptr()

void mat3i_identity_ptr ( matrix3i * res)

Fills the given 3x3 integer matrix with the identity matrix.

Parameters
resPointer to the result matrix.

Definition at line 12 of file matrix3i_ptr.c.

References matrix3i::m11, matrix3i::m12, matrix3i::m13, matrix3i::m21, matrix3i::m22, matrix3i::m23, matrix3i::m31, matrix3i::m32, and matrix3i::m33.

Referenced by mat3i_identity(), and mat3i_inverse_ptr().

◆ mat3i_inverse_ptr()

void mat3i_inverse_ptr ( matrix3i * res,
const matrix3i * m )

Computes the inverse of a 3x3 integer matrix using adjugate over determinant.

If the determinant is zero (singular), sets the result to the identity matrix.

Parameters
resPointer to the result matrix.
mPointer to the input matrix.

Definition at line 67 of file matrix3i_ptr.c.

References matrix3i::m11, matrix3i::m12, matrix3i::m13, matrix3i::m21, matrix3i::m22, matrix3i::m23, matrix3i::m31, matrix3i::m32, matrix3i::m33, mat3i_determinant(), and mat3i_identity_ptr().

Referenced by mat3i_inverse().

◆ mat3i_mul_ptr()

void mat3i_mul_ptr ( matrix3i * res,
const matrix3i * a,
const matrix3i * b )

Multiplies two 3x3 integer matrices (standard matrix multiplication).

Parameters
resPointer to the result matrix.
aPointer to the first input matrix.
bPointer to the second input matrix.

Definition at line 26 of file matrix3i_ptr.c.

References matrix3i::m11, matrix3i::m12, matrix3i::m13, matrix3i::m21, matrix3i::m22, matrix3i::m23, matrix3i::m31, matrix3i::m32, and matrix3i::m33.

Referenced by mat3i_mul().

◆ mat3i_mul_vec2i_ptr()

void mat3i_mul_vec2i_ptr ( vector2i * res,
const matrix3i * m,
const vector2i * v )

Applies a 3x3 integer affine transform to a vector2i.

Parameters
resOutput value.
mInput matrix.
vInput vector.

Definition at line 115 of file matrix3i_ptr.c.

References matrix3i::m11, matrix3i::m12, matrix3i::m13, matrix3i::m21, matrix3i::m22, matrix3i::m23, vector2i::x, and vector2i::y.

Referenced by mat3i_mul_vec2i().

◆ mat3i_mul_vec3i_ptr()

void mat3i_mul_vec3i_ptr ( vector3i * res,
const matrix3i * m,
const vector3i * v )

Multiplies a 3x3 integer matrix by a vector3i.

Parameters
resOutput value.
mInput matrix.
vInput vector.

Definition at line 98 of file matrix3i_ptr.c.

References matrix3i::m11, matrix3i::m12, matrix3i::m13, matrix3i::m21, matrix3i::m22, matrix3i::m23, matrix3i::m31, matrix3i::m32, matrix3i::m33, vector3i::x, vector3i::y, and vector3i::z.

Referenced by mat3i_mul_vec3i().

◆ mat3i_transpose_ptr()

void mat3i_transpose_ptr ( matrix3i * res,
const matrix3i * m )

Computes the transpose of a 3x3 integer matrix.

Parameters
resPointer to the result matrix.
mPointer to the input matrix.

Definition at line 50 of file matrix3i_ptr.c.

References matrix3i::m11, matrix3i::m12, matrix3i::m13, matrix3i::m21, matrix3i::m22, matrix3i::m23, matrix3i::m31, matrix3i::m32, and matrix3i::m33.

Referenced by mat3i_transpose().