|
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 | mat3_identity_ptr (matrix3 *res) |
| Initializes the 3x3 matrix to identity (diagonal 1.0, others 0.0). | |
| void | mat3_mul_ptr (matrix3 *res, const matrix3 *a, const matrix3 *b) |
| Multiplies two 3x3 matrices (a * b) in column-major / column-vector convention. | |
| void | mat3_transpose_ptr (matrix3 *res, const matrix3 *m) |
| Computes the transpose of the input 3x3 matrix and stores in res. | |
| void | mat3_inverse_ptr (matrix3 *res, const matrix3 *m) |
| Computes the inverse of the input 3x3 matrix using the adjugate method and stores in res. | |
| void | mat3_rotation_z_ptr (matrix3 *res, const vm_float_t degrees) |
| Sets the 3x3 matrix to a rotation around the Z-axis by the given angle in degrees. | |
| void | mat3_rotation_x_ptr (matrix3 *res, const vm_float_t degrees) |
| Builds a 3x3 rotation matrix around the X axis (degrees). | |
| void | mat3_rotation_y_ptr (matrix3 *res, const vm_float_t degrees) |
| Builds a 3x3 rotation matrix around the Y axis (degrees). | |
| void | mat3_translate_ptr (matrix3 *res, const vector2 *t) |
| Builds a 3x3 2D translation matrix. | |
| void | mat3_scale_ptr (matrix3 *res, const vector2 *s) |
| Builds a 3x3 2D scaling matrix. | |
| void | mat3_from_mat4_ptr (matrix3 *res, const matrix4 *m) |
| Copies the upper-left 3x3 of a matrix4. | |
| void | mat3_mul_vec3_ptr (vector3 *res, const matrix3 *m, const vector3 *v) |
| Multiplies a 3x3 matrix by a vector3. | |
| void | mat3_mul_vec2_ptr (vector2 *res, const matrix3 *m, const vector2 *v) |
| Applies a 3x3 affine transform to a vector2. | |
Copies the upper-left 3x3 of a matrix4.
| res | Output value. |
| m | Input matrix. |
Definition at line 199 of file matrix3_ptr.c.
References matrix3::m11, matrix4::m11, matrix3::m12, matrix4::m12, matrix3::m13, matrix4::m13, matrix3::m21, matrix4::m21, matrix3::m22, matrix4::m22, matrix3::m23, matrix4::m23, matrix3::m31, matrix4::m31, matrix3::m32, matrix4::m32, matrix3::m33, and matrix4::m33.
Referenced by mat3_from_mat4().
| void mat3_identity_ptr | ( | matrix3 * | res | ) |
Initializes the 3x3 matrix to identity (diagonal 1.0, others 0.0).
| res | Pointer to the output matrix3. |
Definition at line 12 of file matrix3_ptr.c.
References matrix3::v.
Referenced by mat3_identity(), mat3_inverse_ptr(), mat3_scale_ptr(), and mat3_translate_ptr().
Computes the inverse of the input 3x3 matrix using the adjugate method and stores in res.
If the determinant is zero, sets res to identity.
| res | Pointer to the output matrix3. |
| m | Pointer to the input matrix. |
Definition at line 78 of file matrix3_ptr.c.
References mat3_identity_ptr(), and matrix3::v.
Referenced by mat3_inverse().
Multiplies two 3x3 matrices (a * b) in column-major / column-vector convention.
Accumulates into a temporary matrix.
| res | Pointer to the output matrix3. |
| a | Pointer to the first matrix. |
| b | Pointer to the second matrix. |
Definition at line 34 of file matrix3_ptr.c.
References matrix3::m11, matrix3::m12, matrix3::m13, matrix3::m21, matrix3::m22, matrix3::m23, matrix3::m31, matrix3::m32, and matrix3::m33.
Referenced by mat3_mul().
Applies a 3x3 affine transform to a vector2.
| res | Output value. |
| m | Input matrix. |
| v | Input vector. |
Definition at line 230 of file matrix3_ptr.c.
References matrix3::m11, matrix3::m12, matrix3::m13, matrix3::m21, matrix3::m22, matrix3::m23, vector2::x, and vector2::y.
Referenced by mat3_mul_vec2().
Multiplies a 3x3 matrix by a vector3.
| res | Output value. |
| m | Input matrix. |
| v | Input vector. |
Definition at line 213 of file matrix3_ptr.c.
References matrix3::m11, matrix3::m12, matrix3::m13, matrix3::m21, matrix3::m22, matrix3::m23, matrix3::m31, matrix3::m32, matrix3::m33, vector3::x, vector3::y, and vector3::z.
Referenced by mat3_mul_vec3().
| void mat3_rotation_x_ptr | ( | matrix3 * | res, |
| const vm_float_t | degrees ) |
Builds a 3x3 rotation matrix around the X axis (degrees).
| res | Output value. |
| degrees | Rotation angle in degrees. |
Definition at line 137 of file matrix3_ptr.c.
References deg_to_rad(), VECMAT_COS, and VECMAT_SIN.
Referenced by mat3_rotation_x().
| void mat3_rotation_y_ptr | ( | matrix3 * | res, |
| const vm_float_t | degrees ) |
Builds a 3x3 rotation matrix around the Y axis (degrees).
| res | Output value. |
| degrees | Rotation angle in degrees. |
Definition at line 155 of file matrix3_ptr.c.
References deg_to_rad(), VECMAT_COS, and VECMAT_SIN.
Referenced by mat3_rotation_y().
| void mat3_rotation_z_ptr | ( | matrix3 * | res, |
| const vm_float_t | degrees ) |
Sets the 3x3 matrix to a rotation around the Z-axis by the given angle in degrees.
| res | Pointer to the output matrix3. |
| degrees | Rotation angle in degrees. |
Definition at line 112 of file matrix3_ptr.c.
References matrix3::m11, matrix3::m12, matrix3::m13, matrix3::m21, matrix3::m22, matrix3::m23, matrix3::m31, matrix3::m32, matrix3::m33, M_PI, VECMAT_COS, and VECMAT_SIN.
Referenced by mat3_rotation_z().
Builds a 3x3 2D scaling matrix.
| res | Output value. |
| s | Scale vector. |
Definition at line 186 of file matrix3_ptr.c.
References matrix3::m11, matrix3::m22, mat3_identity_ptr(), vector2::x, and vector2::y.
Referenced by mat3_scale().
Builds a 3x3 2D translation matrix.
| res | Output value. |
| t | Translation vector. |
Definition at line 173 of file matrix3_ptr.c.
References matrix3::m13, matrix3::m23, mat3_identity_ptr(), vector2::x, and vector2::y.
Referenced by mat3_translate().
Computes the transpose of the input 3x3 matrix and stores in res.
| res | Pointer to the output matrix3. |
| m | Pointer to the input matrix. |
Definition at line 58 of file matrix3_ptr.c.
References matrix3::v.
Referenced by mat3_transpose().