matrix2_ptr.c file
Functions
- void mat2_identity_ptr(matrix2* res)
- Initializes the 2x2 matrix to identity (diagonal 1.0, others 0.0).
- 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_inverse_ptr(matrix2* res, const matrix2* m)
- Computes the inverse of the input 2x2 matrix using determinant and stores in res.
- void mat2_mul_vec2_ptr(vector2* res, const matrix2* m, const vector2* v)
- Multiplies a 2x2 matrix by a vector2.
-
void mat2_rotation_z_ptr(matrix2* res,
const vm_
float_ t radians) - Sets the 2x2 matrix to a Z-axis (counter-clockwise) rotation.
-
void mat2_rotation_z_deg_ptr(matrix2* res,
const vm_
float_ t degrees) - Initializes the 2x2 matrix to a rotation around Z axis (counter-clockwise).
- void mat2_scale_ptr(matrix2* res, const vector2* s)
- Builds a 2x2 scaling matrix from a vector2.
- void mat2_from_mat3_ptr(matrix2* res, const matrix3* m)
- Copies the upper-left 2x2 of a matrix3.
Function documentation
void mat2_identity_ptr(matrix2* res)
Initializes the 2x2 matrix to identity (diagonal 1.0, others 0.0).
| Parameters | |
|---|---|
| res | Pointer to the output matrix2. |
void mat2_mul_ptr(matrix2* res, const matrix2* a, const matrix2* b)
Multiplies two 2x2 matrices (a * b) in column-major / column-vector convention.
| Parameters | |
|---|---|
| res | Pointer to the output matrix2. |
| a | Pointer to the first matrix. |
| b | Pointer to the second matrix. |
void mat2_transpose_ptr(matrix2* res, const matrix2* m)
Computes the transpose of the input 2x2 matrix and stores in res.
| Parameters | |
|---|---|
| res | Pointer to the output matrix2. |
| m | Pointer to the input matrix. |
void mat2_inverse_ptr(matrix2* res, const matrix2* m)
Computes the inverse of the input 2x2 matrix using determinant and stores in res.
| Parameters | |
|---|---|
| res | Pointer to the output matrix2. |
| m | Pointer to the input matrix. |
If the determinant is zero, sets res to identity matrix.
void mat2_mul_vec2_ptr(vector2* res, const matrix2* m, const vector2* v)
Multiplies a 2x2 matrix by a vector2.
| Parameters | |
|---|---|
| res | Output value. |
| m | Input matrix. |
| v | Input vector. |
void mat2_rotation_z_ptr(matrix2* res,
const vm_ float_ t radians)
Sets the 2x2 matrix to a Z-axis (counter-clockwise) rotation.
| Parameters | |
|---|---|
| res | Pointer to the output matrix2. |
| radians | Rotation angle in radians. |
void mat2_rotation_z_deg_ptr(matrix2* res,
const vm_ float_ t degrees)
Initializes the 2x2 matrix to a rotation around Z axis (counter-clockwise).
| Parameters | |
|---|---|
| res | Pointer to the output matrix2. |
| degrees | Rotation angle in degrees. |
void mat2_scale_ptr(matrix2* res, const vector2* s)
Builds a 2x2 scaling matrix from a vector2.
| Parameters | |
|---|---|
| res | Output value. |
| s | Scale vector. |
void mat2_from_mat3_ptr(matrix2* res, const matrix3* m)
Copies the upper-left 2x2 of a matrix3.
| Parameters | |
|---|---|
| res | Output value. |
| m | Input matrix. |