matrix2.c file
Functions
- auto mat2_identity(void) -> matrix2
- Constructs the 2x2 identity matrix.
- auto mat2_mul(const matrix2 a, const matrix2 b) -> matrix2
- Multiplies two 2x2 matrices (a * b).
- auto mat2_transpose(const matrix2 m) -> matrix2
- Computes the transpose of a 2x2 matrix.
- auto mat2_inverse(const matrix2 m) -> matrix2
- Computes the inverse of a 2x2 matrix.
-
auto mat2_rotation_z(const vm_
float_ t radians) -> matrix2 - Constructs a 2x2 rotation matrix around the Z axis.
-
auto mat2_rotation_z_deg(const vm_
float_ t degrees) -> matrix2 - Constructs a 2x2 rotation matrix from an angle in degrees around the Z axis.
-
auto mat2_determinant(const matrix2 m) -> vm_
float_ t - Calculates the determinant of the given 2x2 matrix.
- auto mat2_mul_vec2(const matrix2 m, const vector2 v) -> vector2
- Multiplies a 2x2 matrix by a vector2.
- auto mat2_scale(const vector2 s) -> matrix2
- Builds a 2x2 scaling matrix from a vector2.
- auto mat2_from_mat3(const matrix3 m) -> matrix2
- Copies the upper-left 2x2 of a matrix3.
Function documentation
matrix2 mat2_transpose(const matrix2 m)
Computes the transpose of a 2x2 matrix.
| Parameters | |
|---|---|
| m | The input matrix. |
| Returns | The transposed matrix2. |
matrix2 mat2_inverse(const matrix2 m)
Computes the inverse of a 2x2 matrix.
| Parameters | |
|---|---|
| m | The input matrix. |
| Returns | The inverse matrix2. |
matrix2 mat2_rotation_z(const vm_ float_ t radians)
Constructs a 2x2 rotation matrix around the Z axis.
| Parameters | |
|---|---|
| radians | Rotation angle in radians. |
| Returns | The rotation matrix2. |
matrix2 mat2_rotation_z_deg(const vm_ float_ t degrees)
Constructs a 2x2 rotation matrix from an angle in degrees around the Z axis.
| Parameters | |
|---|---|
| degrees | The rotation angle in degrees. |
| Returns | The rotation matrix2. |
vm_ float_ t mat2_determinant(const matrix2 m)
Calculates the determinant of the given 2x2 matrix.
| Parameters | |
|---|---|
| m | The matrix. |
| Returns | The determinant value (m.v[0]*m.v[3] - m.v[1]*m.v[2]). |
matrix2 mat2_scale(const vector2 s)
Builds a 2x2 scaling matrix from a vector2.
| Parameters | |
|---|---|
| s | Scale vector. |
| Returns | The resulting matrix2. |
matrix2 mat2_from_mat3(const matrix3 m)
Copies the upper-left 2x2 of a matrix3.
| Parameters | |
|---|---|
| m | Input matrix. |
| Returns | The resulting matrix2. |