|
Vecmat 0.2.3
C math and linear algebra library for 2D/3D graphics, physics, and science.
|
#include <vecmat.h>Go to the source code of this 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 degrees) |
| Sets res to a 2x2 rotation matrix for rotation around the Z-axis. | |
| 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. | |
Copies the upper-left 2x2 of a matrix3.
| res | Output value. |
| m | Input matrix. |
Definition at line 128 of file matrix2_ptr.c.
References matrix3::m11, matrix3::m12, matrix3::m21, and matrix3::m22.
Referenced by mat2_from_mat3().
| void mat2_identity_ptr | ( | matrix2 * | res | ) |
Initializes the 2x2 matrix to identity (diagonal 1.0, others 0.0).
| res | Pointer to the output matrix2. |
Definition at line 12 of file matrix2_ptr.c.
References matrix2::v.
Referenced by mat2_identity(), and mat2_inverse_ptr().
Computes the inverse of the input 2x2 matrix using determinant and stores in res.
If the determinant is zero, sets res to identity matrix.
| res | Pointer to the output matrix2. |
| m | Pointer to the input matrix. |
Definition at line 60 of file matrix2_ptr.c.
References mat2_determinant(), mat2_identity_ptr(), and matrix2::v.
Referenced by mat2_inverse().
Multiplies two 2x2 matrices (a * b) in column-major / column-vector convention.
| res | Pointer to the output matrix2. |
| a | Pointer to the first matrix. |
| b | Pointer to the second matrix. |
Definition at line 26 of file matrix2_ptr.c.
References matrix2::m11, matrix2::m12, matrix2::m21, and matrix2::m22.
Referenced by mat2_mul().
Multiplies a 2x2 matrix by a vector2.
| res | Output value. |
| m | Input matrix. |
| v | Input vector. |
Definition at line 81 of file matrix2_ptr.c.
References matrix2::m11, matrix2::m12, matrix2::m21, matrix2::m22, vector2::x, and vector2::y.
Referenced by mat2_mul_vec2().
| void mat2_rotation_z_ptr | ( | matrix2 * | res, |
| const vm_float_t | degrees ) |
Sets res to a 2x2 rotation matrix for rotation around the Z-axis.
Converts degrees to radians; positive is counter-clockwise.
| res | Pointer to the output matrix2. |
| degrees | Rotation angle in degrees. |
Definition at line 97 of file matrix2_ptr.c.
References deg_to_rad(), VECMAT_COS, and VECMAT_SIN.
Referenced by mat2_rotation_z().
Builds a 2x2 scaling matrix from a vector2.
| res | Output value. |
| s | Scale vector. |
Definition at line 114 of file matrix2_ptr.c.
References vector2::x, and vector2::y.
Referenced by mat2_scale().
Computes the transpose of the input 2x2 matrix and stores in res.
| res | Pointer to the output matrix2. |
| m | Pointer to the input matrix. |
Definition at line 43 of file matrix2_ptr.c.
References matrix2::v.
Referenced by mat2_transpose().