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

Go to the source code of this file.

Functions

matrix3 mat3_identity (void)
 Constructs the 3x3 identity matrix.
matrix3 mat3_mul (const matrix3 a, const matrix3 b)
 Multiplies two 3x3 matrices.
matrix3 mat3_transpose (const matrix3 m)
 Computes the transpose of a 3x3 matrix.
matrix3 mat3_inverse (const matrix3 m)
 Computes the inverse of a 3x3 matrix.
matrix3 mat3_rotation_z (const vm_float_t degrees)
 Constructs the 3x3 rotation matrix around the Z-axis.
vm_float_t mat3_determinant (const matrix3 m)
 Computes the determinant of a 3x3 matrix.
vector3 mat3_mul_vec3 (const matrix3 m, const vector3 v)
 Multiplies a 3x3 matrix by a vector3.
vector2 mat3_mul_vec2 (const matrix3 m, const vector2 v)
 Applies a 3x3 affine transform to a vector2.
matrix3 mat3_rotation_x (const vm_float_t degrees)
 Builds a 3x3 rotation matrix around the X axis (degrees).
matrix3 mat3_rotation_y (const vm_float_t degrees)
 Builds a 3x3 rotation matrix around the Y axis (degrees).
matrix3 mat3_translate (const vector2 t)
 Builds a 3x3 2D translation matrix.
matrix3 mat3_scale (const vector2 s)
 Builds a 3x3 2D scaling matrix.
matrix3 mat3_from_mat4 (const matrix4 m)
 Copies the upper-left 3x3 of a matrix4.

Function Documentation

◆ mat3_determinant()

vm_float_t mat3_determinant ( const matrix3 m)

Computes the determinant of a 3x3 matrix.

Parameters
mThe input matrix.
Returns
The determinant value.

Definition at line 88 of file matrix3.c.

References matrix3::v.

◆ mat3_from_mat4()

matrix3 mat3_from_mat4 ( const matrix4 m)

Copies the upper-left 3x3 of a matrix4.

See mat3_from_mat4_ptr instead.

Parameters
mInput matrix.
Returns
The resulting matrix3.

Definition at line 195 of file matrix3.c.

References mat3_from_mat4_ptr().

◆ mat3_identity()

matrix3 mat3_identity ( void )

Constructs the 3x3 identity matrix.

See mat3_identity_ptr instead.

Returns
The identity matrix3.

Definition at line 14 of file matrix3.c.

References mat3_identity_ptr().

◆ mat3_inverse()

matrix3 mat3_inverse ( const matrix3 m)

Computes the inverse of a 3x3 matrix.

See mat3_inverse_ptr instead.

Parameters
mThe input matrix.
Returns
The inverse matrix.

Definition at line 60 of file matrix3.c.

References mat3_inverse_ptr().

◆ mat3_mul()

matrix3 mat3_mul ( const matrix3 a,
const matrix3 b )

Multiplies two 3x3 matrices.

See mat3_mul_ptr instead.

Parameters
aThe first matrix.
bThe second matrix.
Returns
The product matrix.

Definition at line 30 of file matrix3.c.

References mat3_mul_ptr().

◆ mat3_mul_vec2()

vector2 mat3_mul_vec2 ( const matrix3 m,
const vector2 v )

Applies a 3x3 affine transform to a vector2.

See mat3_mul_vec2_ptr instead.

Parameters
mInput matrix.
vInput vector.
Returns
The resulting vector2.

Definition at line 120 of file matrix3.c.

References mat3_mul_vec2_ptr().

◆ mat3_mul_vec3()

vector3 mat3_mul_vec3 ( const matrix3 m,
const vector3 v )

Multiplies a 3x3 matrix by a vector3.

See mat3_mul_vec3_ptr instead.

Parameters
mInput matrix.
vInput vector.
Returns
The resulting vector3.

Definition at line 104 of file matrix3.c.

References mat3_mul_vec3_ptr().

◆ mat3_rotation_x()

matrix3 mat3_rotation_x ( const vm_float_t degrees)

Builds a 3x3 rotation matrix around the X axis (degrees).

See mat3_rotation_x_ptr instead.

Parameters
degreesRotation angle in degrees.
Returns
The resulting matrix3.

Definition at line 135 of file matrix3.c.

References mat3_rotation_x_ptr().

◆ mat3_rotation_y()

matrix3 mat3_rotation_y ( const vm_float_t degrees)

Builds a 3x3 rotation matrix around the Y axis (degrees).

See mat3_rotation_y_ptr instead.

Parameters
degreesRotation angle in degrees.
Returns
The resulting matrix3.

Definition at line 150 of file matrix3.c.

References mat3_rotation_y_ptr().

◆ mat3_rotation_z()

matrix3 mat3_rotation_z ( const vm_float_t degrees)

Constructs the 3x3 rotation matrix around the Z-axis.

See mat3_rotation_z_ptr instead.

Parameters
degreesThe rotation angle in degrees.
Returns
The rotation matrix3.

Definition at line 75 of file matrix3.c.

References mat3_rotation_z_ptr().

◆ mat3_scale()

matrix3 mat3_scale ( const vector2 s)

Builds a 3x3 2D scaling matrix.

See mat3_scale_ptr instead.

Parameters
sScale vector.
Returns
The resulting matrix3.

Definition at line 180 of file matrix3.c.

References mat3_scale_ptr().

◆ mat3_translate()

matrix3 mat3_translate ( const vector2 t)

Builds a 3x3 2D translation matrix.

See mat3_translate_ptr instead.

Parameters
tTranslation vector.
Returns
The resulting matrix3.

Definition at line 165 of file matrix3.c.

References mat3_translate_ptr().

◆ mat3_transpose()

matrix3 mat3_transpose ( const matrix3 m)

Computes the transpose of a 3x3 matrix.

See mat3_transpose_ptr instead.

Parameters
mThe input matrix.
Returns
The transposed matrix.

Definition at line 45 of file matrix3.c.

References mat3_transpose_ptr().