|
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 | |
| matrix4 | mat4_identity (void) |
| Constructs the 4x4 identity matrix. | |
| matrix4 | mat4_mul (const matrix4 a, const matrix4 b) |
| Multiplies two 4x4 matrices (a * b). | |
| matrix4 | mat4_transpose (const matrix4 m) |
| Computes the transpose of a 4x4 matrix. | |
| matrix4 | mat4_inverse (const matrix4 m) |
| Computes the inverse of a 4x4 matrix. | |
| matrix4 | mat4_translate (const vector3 v) |
| Constructs a translation matrix from the given vector. | |
| matrix4 | mat4_scale (const vector3 v) |
| Constructs a scaling matrix from the given scale vector. | |
| matrix4 | mat4_rotation (const vector3 axis, const vm_float_t angle) |
| Constructs a rotation matrix around the given axis by the specified angle (in radians). | |
| matrix4 | mat4_perspective (const vm_float_t fov, const vm_float_t aspect, const vm_float_t near, const vm_float_t far) |
| Constructs a perspective projection matrix. | |
| matrix4 | mat4_ortho (const vm_float_t left, const vm_float_t right, const vm_float_t bottom, const vm_float_t top, const vm_float_t near, const vm_float_t far) |
| Constructs an orthographic projection matrix. | |
| matrix4 | mat4_look_at (const vector3 position, const vector3 target, const vector3 up) |
| Constructs a view matrix from eye position, target, and up vector. | |
| matrix4 | mat4_perspective_fov (const vm_float_t fov, const vm_float_t w, const vm_float_t h, const vm_float_t n, const vm_float_t f) |
| Constructs a perspective projection matrix using FOV, width, and height. | |
| matrix4 | mat4_perspective_infinite (const vm_float_t fov_y, const vm_float_t aspect, const vm_float_t n) |
| Constructs an infinite far-plane perspective projection matrix. | |
| vm_float_t | mat4_determinant (const matrix4 m) |
| Calculates the determinant of the given 4x4 matrix. | |
| vector4 | mat4_mul_vec4 (const matrix4 m, const vector4 v) |
| Multiplies a 4x4 matrix by a vector4. | |
| vector3 | mat4_mul_vec3 (const matrix4 m, const vector3 v, const vm_float_t w) |
| Transforms a vector3 by a 4x4 matrix using homogeneous w. | |
| matrix4 | mat4_rotation_x (const vm_float_t degrees) |
| Builds a 4x4 rotation matrix around the X axis (degrees). | |
| matrix4 | mat4_rotation_y (const vm_float_t degrees) |
| Builds a 4x4 rotation matrix around the Y axis (degrees). | |
| matrix4 | mat4_rotation_z (const vm_float_t degrees) |
| Builds a 4x4 rotation matrix around the Z axis (degrees). | |
| matrix4 | mat4_trs (const vector3 translation, const quaternion rotation, const vector3 scale) |
| Builds a 4x4 TRS matrix from translation, rotation, and scale. | |
| matrix4 | mat4_from_mat3 (const matrix3 m) |
| Embeds a matrix3 into the upper-left of a matrix4. | |
| vector3 | mat4_extract_translation (const matrix4 m) |
| Extracts the translation vector from a matrix4. | |
| vector3 | mat4_extract_scale (const matrix4 m) |
| Extracts the scale vector from a matrix4. | |
| quaternion | mat4_extract_rotation (const matrix4 m) |
| Extracts the rotation quaternion from a matrix4. | |
| vm_float_t mat4_determinant | ( | const matrix4 | m | ) |
Calculates the determinant of the given 4x4 matrix.
Uses cofactor expansion for computation.
| m | The matrix. |
Definition at line 214 of file matrix4.c.
References matrix4::v.
| quaternion mat4_extract_rotation | ( | const matrix4 | m | ) |
Extracts the rotation quaternion from a matrix4.
See mat4_extract_rotation_ptr instead.
| m | Input matrix. |
Definition at line 379 of file matrix4.c.
References mat4_extract_rotation_ptr().
Extracts the scale vector from a matrix4.
See mat4_extract_scale_ptr instead.
| m | Input matrix. |
Definition at line 364 of file matrix4.c.
References mat4_extract_scale_ptr().
Extracts the translation vector from a matrix4.
See mat4_extract_translation_ptr instead.
| m | Input matrix. |
Definition at line 349 of file matrix4.c.
References mat4_extract_translation_ptr().
Embeds a matrix3 into the upper-left of a matrix4.
See mat4_from_mat3_ptr instead.
| m | Input matrix. |
Definition at line 334 of file matrix4.c.
References mat4_from_mat3_ptr().
| matrix4 mat4_identity | ( | void | ) |
Constructs the 4x4 identity matrix.
See mat4_identity_ptr instead.
Definition at line 14 of file matrix4.c.
References mat4_identity_ptr().
Referenced by mat4_look_at_ptr().
Computes the inverse of a 4x4 matrix.
See mat4_inverse_ptr instead.
| m | The input matrix. |
Definition at line 60 of file matrix4.c.
References mat4_inverse_ptr().
Constructs a view matrix from eye position, target, and up vector.
See mat4_look_at_ptr instead.
| position | Eye position. |
| target | Target position. |
| up | Up vector. |
Definition at line 162 of file matrix4.c.
References mat4_look_at_ptr().
Multiplies two 4x4 matrices (a * b).
See mat4_mul_ptr instead.
| a | The first matrix. |
| b | The second matrix. |
Definition at line 30 of file matrix4.c.
References mat4_mul_ptr().
| vector3 mat4_mul_vec3 | ( | const matrix4 | m, |
| const vector3 | v, | ||
| const vm_float_t | w ) |
Transforms a vector3 by a 4x4 matrix using homogeneous w.
See mat4_mul_vec3_ptr instead.
| m | Input matrix. |
| v | Input vector. |
| w | Homogeneous w component. |
Definition at line 257 of file matrix4.c.
References mat4_mul_vec3_ptr().
Multiplies a 4x4 matrix by a vector4.
See mat4_mul_vec4_ptr instead.
| m | Input matrix. |
| v | Input vector. |
Definition at line 240 of file matrix4.c.
References mat4_mul_vec4_ptr().
| matrix4 mat4_ortho | ( | const vm_float_t | left, |
| const vm_float_t | right, | ||
| const vm_float_t | bottom, | ||
| const vm_float_t | top, | ||
| const vm_float_t | near, | ||
| const vm_float_t | far ) |
Constructs an orthographic projection matrix.
See mat4_ortho_ptr instead.
| left | Left clipping plane. |
| right | Right clipping plane. |
| bottom | Bottom clipping plane. |
| top | Top clipping plane. |
| near | Near plane distance. |
| far | Far plane distance. |
Definition at line 144 of file matrix4.c.
References mat4_ortho_ptr().
| matrix4 mat4_perspective | ( | const vm_float_t | fov, |
| const vm_float_t | aspect, | ||
| const vm_float_t | near, | ||
| const vm_float_t | far ) |
Constructs a perspective projection matrix.
See mat4_perspective_ptr instead.
| fov | Field of view (radians). |
| aspect | Aspect ratio (width/height). |
| near | Near plane distance. |
| far | Far plane distance. |
Definition at line 124 of file matrix4.c.
References mat4_perspective_ptr().
| matrix4 mat4_perspective_fov | ( | const vm_float_t | fov, |
| const vm_float_t | w, | ||
| const vm_float_t | h, | ||
| const vm_float_t | n, | ||
| const vm_float_t | f ) |
Constructs a perspective projection matrix using FOV, width, and height.
See mat4_perspective_fov_ptr instead.
| fov | Vertical field of view (radians). |
| w | Viewport width. |
| h | Viewport height. |
| n | Near plane. |
| f | Far plane. |
Definition at line 181 of file matrix4.c.
References mat4_perspective_fov_ptr().
| matrix4 mat4_perspective_infinite | ( | const vm_float_t | fov_y, |
| const vm_float_t | aspect, | ||
| const vm_float_t | n ) |
Constructs an infinite far-plane perspective projection matrix.
See mat4_perspective_infinite_ptr instead.
| fov_y | Vertical field of view (radians). |
| aspect | Aspect ratio. |
| n | Near plane distance. |
Definition at line 199 of file matrix4.c.
References mat4_perspective_infinite_ptr().
| matrix4 mat4_rotation | ( | const vector3 | axis, |
| const vm_float_t | angle ) |
Constructs a rotation matrix around the given axis by the specified angle (in radians).
See mat4_rotation_ptr instead.
| axis | The rotation axis vector. |
| angle | The rotation angle in radians. |
Definition at line 106 of file matrix4.c.
References mat4_rotation_ptr().
| matrix4 mat4_rotation_x | ( | const vm_float_t | degrees | ) |
Builds a 4x4 rotation matrix around the X axis (degrees).
See mat4_rotation_x_ptr instead.
| degrees | Rotation angle in degrees. |
Definition at line 272 of file matrix4.c.
References mat4_rotation_x_ptr().
| matrix4 mat4_rotation_y | ( | const vm_float_t | degrees | ) |
Builds a 4x4 rotation matrix around the Y axis (degrees).
See mat4_rotation_y_ptr instead.
| degrees | Rotation angle in degrees. |
Definition at line 287 of file matrix4.c.
References mat4_rotation_y_ptr().
| matrix4 mat4_rotation_z | ( | const vm_float_t | degrees | ) |
Builds a 4x4 rotation matrix around the Z axis (degrees).
See mat4_rotation_z_ptr instead.
| degrees | Rotation angle in degrees. |
Definition at line 302 of file matrix4.c.
References mat4_rotation_z_ptr().
Constructs a scaling matrix from the given scale vector.
See mat4_scale_ptr instead.
| v | The scale vector (x, y, z factors). |
Definition at line 90 of file matrix4.c.
References mat4_scale_ptr().
Constructs a translation matrix from the given vector.
See mat4_translate_ptr instead.
| v | The translation vector (x, y, z). |
Definition at line 75 of file matrix4.c.
References mat4_translate_ptr().
Computes the transpose of a 4x4 matrix.
See mat4_transpose_ptr instead.
| m | The input matrix. |
Definition at line 45 of file matrix4.c.
References mat4_transpose_ptr().
| matrix4 mat4_trs | ( | const vector3 | translation, |
| const quaternion | rotation, | ||
| const vector3 | scale ) |
Builds a 4x4 TRS matrix from translation, rotation, and scale.
See mat4_trs_ptr instead.
| translation | Translation vector. |
| rotation | Rotation quaternion. |
| scale | Scale vector. |
Definition at line 319 of file matrix4.c.
References mat4_trs_ptr().