|
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 | |
| vector4i | vec4i_zero (void) |
| Returns a zero-initialized vector4i. | |
| vector4i | vec4i_one (void) |
| Returns a vector4i with all components set to 1. | |
| vector4i | vec4i_x_axis (const vm_int_t x) |
| Returns a vector4i along the x-axis. | |
| vector4i | vec4i_y_axis (const vm_int_t y) |
| Returns a vector4i along the y-axis. | |
| vector4i | vec4i_z_axis (const vm_int_t z) |
| Returns a vector4i along the z-axis. | |
| vector4i | vec4i_w_axis (const vm_int_t w) |
| Returns a vector4i along the w-axis. | |
| vector4i | vec4i_x_scale (const vm_int_t x) |
| Returns a vector4i for scaling along the x-axis. | |
| vector4i | vec4i_y_scale (const vm_int_t y) |
| Returns a vector4i for scaling along the y-axis. | |
| vector4i | vec4i_z_scale (const vm_int_t z) |
| Returns a vector4i for scaling along the z-axis. | |
| vector4i | vec4i_w_scale (const vm_int_t w) |
| Returns a vector4i for scaling along the w-axis. | |
| vector4i | vec4i_add (const vector4i a, const vector4i b) |
| Component-wise addition of two vectors. | |
| vector4i | vec4i_sub (const vector4i a, const vector4i b) |
| Component-wise subtraction of two vectors. | |
| vector4i | vec4i_mul_scalar (const vector4i v, const vm_int_t s) |
| Component-wise multiplication of vector by scalar. | |
| vector4i | vec4i_div_scalar (const vector4i v, const vm_int_t s) |
| Component-wise division of vector by scalar. | |
| vector4i | vec4i_mul (const vector4i a, const vector4i b) |
| Component-wise multiplication of two vectors. | |
| vector4i | vec4i_neg (const vector4i v) |
| Negation of a vector. | |
| vector4i | vec4i_abs (const vector4i v) |
| Computes the absolute value per component of a vector4i. | |
| vector4i | vec4i_normalize (const vector4i v) |
| Normalizes a vector4i to unit length. | |
| vector4i | vec4i_min (const vector4i a, const vector4i b) |
| Computes the component-wise minimum of two vector4i. | |
| vector4i | vec4i_max (const vector4i a, const vector4i b) |
| Computes the component-wise maximum of two vector4i. | |
| vector4i | vec4i_sign (const vector4i v) |
| Computes the sign per component of a vector4i (-1, 0, or 1). | |
| vector4i | vec4i_lerp (const vector4i a, const vector4i b, const vm_float_t t) |
| Linearly interpolates between two vector4i. | |
| vector4i | vec4i_clamp (const vector4i v, const vector4i min, const vector4i max) |
| Clamps each component of the input vector to the range defined by the minimum and maximum vectors. | |
| vm_int_t | vec4i_dot (const vector4i a, const vector4i b) |
| Computes the dot product of two vector4i. | |
| vm_float_t | vec4i_length (const vector4i v) |
| Computes the length (magnitude) of a vector4i. | |
| vm_float_t | vec4i_distance (const vector4i a, const vector4i b) |
| Computes the Euclidean distance between two vector4i. | |
| vector3i | vec4i_to_vec3i (const vector4i v) |
| Converts a vector4i to a vector3i (discards the w component). | |
| vector4i | vec4i_div (const vector4i a, const vector4i b) |
| Divides two vectors component-wise. | |
| vector4i | vec4i_add_scalar (const vector4i v, const vm_int_t s) |
| Adds a scalar to each component. | |
| vector4i | vec4i_sub_scalar (const vector4i v, const vm_int_t s) |
| Subtracts a scalar from each component. | |
| vector4i | vec4i_mod (const vector4i a, const vector4i b) |
| Component-wise floor modulo of a by b. | |
| vector4i | vec4i_div_floor (const vector4i a, const vector4i b) |
| Component-wise floored division of a by b. | |
| vector4i | vec4i_wrap (const vector4i v, const vector4i period) |
| Wraps each component of v into [0, period). | |
| vector4i | vec4i_splat (const vm_int_t s) |
| Returns a vector with every component set to s. | |
| vm_int_t | vec4i_length_squared (const vector4i v) |
| Returns the squared Euclidean length. | |
| vm_int_t | vec4i_distance_squared (const vector4i a, const vector4i b) |
| Returns the squared Euclidean distance between a and b. | |
| vm_int_t | vec4i_length_manhattan (const vector4i v) |
| Returns the Manhattan (L1) length. | |
| vm_int_t | vec4i_length_chebyshev (const vector4i v) |
| Returns the Chebyshev (L-inf) length. | |
| vm_int_t | vec4i_min_component (const vector4i v) |
| Returns the smallest component. | |
| vm_int_t | vec4i_max_component (const vector4i v) |
| Returns the largest component. | |
| vm_int_t | vec4i_sum (const vector4i v) |
| Returns the sum of all components. | |
| bool | vec4i_is_zero (const vector4i v) |
| Returns true if every component is zero. | |
Computes the absolute value per component of a vector4i.
See vec4i_abs_ptr for the out-parameter version.
| v | The vector. |
Definition at line 217 of file vector4i.c.
References vec4i_abs_ptr().
Component-wise addition of two vectors.
See vec4i_add_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 123 of file vector4i.c.
References vec4i_add_ptr().
Adds a scalar to each component.
See vec4i_add_scalar_ptr instead.
| v | Input vector. |
| s | Scalar value. |
Definition at line 395 of file vector4i.c.
References vec4i_add_scalar_ptr().
Clamps each component of the input vector to the range defined by the minimum and maximum vectors.
See vec4i_clamp_ptr for the out-parameter version.
| v | The input vector. |
| min | The minimum value for each component. |
| max | The maximum value for each component. |
Definition at line 314 of file vector4i.c.
References vec4i_clamp_ptr().
| vm_float_t vec4i_distance | ( | const vector4i | a, |
| const vector4i | b ) |
Computes the Euclidean distance between two vector4i.
| a | First vector. |
| b | Second vector. |
Definition at line 351 of file vector4i.c.
References vec4i_length(), and vec4i_sub().
Returns the squared Euclidean distance between a and b.
| a | First input vector. |
| b | Second input vector. |
Definition at line 497 of file vector4i.c.
References vec4i_length_squared(), and vec4i_sub().
Divides two vectors component-wise.
See vec4i_div_ptr instead.
| a | First input vector. |
| b | Second input vector. |
Definition at line 379 of file vector4i.c.
References vec4i_div_ptr().
Component-wise floored division of a by b.
See vec4i_div_floor_ptr instead.
| a | First input vector. |
| b | Second input vector. |
Definition at line 443 of file vector4i.c.
References vec4i_div_floor_ptr().
Component-wise division of vector by scalar.
See vec4i_div_scalar_ptr for the out-parameter version.
| v | The vector. |
| s | The scalar (non-zero). |
Definition at line 171 of file vector4i.c.
References vec4i_div_scalar_ptr().
Computes the dot product of two vector4i.
| a | First vector. |
| b | Second vector. |
Definition at line 328 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
Referenced by vec4i_length(), and vec4i_length_squared().
| bool vec4i_is_zero | ( | const vector4i | v | ) |
Returns true if every component is zero.
| v | Input vector. |
Definition at line 582 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
| vm_float_t vec4i_length | ( | const vector4i | v | ) |
Computes the length (magnitude) of a vector4i.
| v | The vector. |
Definition at line 339 of file vector4i.c.
References vec4i_dot(), and VECMAT_SQRT.
Referenced by vec4i_distance(), and vec4i_normalize_ptr().
Returns the Chebyshev (L-inf) length.
| v | Input vector. |
Definition at line 523 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
Returns the Manhattan (L1) length.
| v | Input vector. |
Definition at line 508 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
Returns the squared Euclidean length.
| v | Input vector. |
Definition at line 485 of file vector4i.c.
References vec4i_dot().
Referenced by vec4i_distance_squared().
| vector4i vec4i_lerp | ( | const vector4i | a, |
| const vector4i | b, | ||
| const vm_float_t | t ) |
Linearly interpolates between two vector4i.
See vec4i_lerp_ptr for the out-parameter version.
| a | Start vector. |
| b | End vector. |
| t | Interpolation factor [0, 1]. |
Definition at line 296 of file vector4i.c.
References vec4i_lerp_ptr().
Computes the component-wise maximum of two vector4i.
See vec4i_max_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 264 of file vector4i.c.
References vec4i_max_ptr().
Returns the largest component.
| v | Input vector. |
Definition at line 556 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
Computes the component-wise minimum of two vector4i.
See vec4i_min_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 248 of file vector4i.c.
References vec4i_min_ptr().
Returns the smallest component.
| v | Input vector. |
Definition at line 541 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
Component-wise floor modulo of a by b.
See vec4i_mod_ptr instead.
| a | First input vector. |
| b | Second input vector. |
Definition at line 427 of file vector4i.c.
References vec4i_mod_ptr().
Component-wise multiplication of two vectors.
See vec4i_mul_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 187 of file vector4i.c.
References vec4i_mul_ptr().
Component-wise multiplication of vector by scalar.
See vec4i_mul_scalar_ptr for the out-parameter version.
| v | The vector. |
| s | The scalar. |
Definition at line 155 of file vector4i.c.
References vec4i_mul_scalar_ptr().
Negation of a vector.
See vec4i_neg_ptr for the out-parameter version.
| v | The vector. |
Definition at line 202 of file vector4i.c.
References vec4i_neg_ptr().
Normalizes a vector4i to unit length.
See vec4i_normalize_ptr for the out-parameter version.
| v | The vector (non-zero). |
Definition at line 232 of file vector4i.c.
References vec4i_normalize_ptr().
| vector4i vec4i_one | ( | void | ) |
Returns a vector4i with all components set to 1.
Definition at line 22 of file vector4i.c.
Computes the sign per component of a vector4i (-1, 0, or 1).
See vec4i_sign_ptr for the out-parameter version.
| v | The vector. |
Definition at line 279 of file vector4i.c.
References vec4i_sign_ptr().
Returns a vector with every component set to s.
See vec4i_splat_ptr instead.
| s | Scalar value. |
Definition at line 474 of file vector4i.c.
Component-wise subtraction of two vectors.
See vec4i_sub_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 139 of file vector4i.c.
References vec4i_sub_ptr().
Referenced by vec4i_distance(), and vec4i_distance_squared().
Subtracts a scalar from each component.
See vec4i_sub_scalar_ptr instead.
| v | Input vector. |
| s | Scalar value. |
Definition at line 411 of file vector4i.c.
References vec4i_sub_scalar_ptr().
Returns the sum of all components.
| v | Input vector. |
Definition at line 571 of file vector4i.c.
References vector4i::w, vector4i::x, vector4i::y, and vector4i::z.
Converts a vector4i to a vector3i (discards the w component).
| v | The source vector4i. |
Definition at line 363 of file vector4i.c.
References vec4i_to_vec3i_ptr().
Returns a vector4i along the w-axis.
| w | The w component value. |
Definition at line 65 of file vector4i.c.
Returns a vector4i for scaling along the w-axis.
| w | The w scale factor. |
Definition at line 109 of file vector4i.c.
Wraps each component of v into [0, period).
See vec4i_wrap_ptr instead.
| v | Input vector. |
| period | Wrap period per component. |
Definition at line 459 of file vector4i.c.
References vec4i_wrap_ptr().
Returns a vector4i along the x-axis.
| x | The x component value. |
Definition at line 33 of file vector4i.c.
Returns a vector4i for scaling along the x-axis.
| x | The x scale factor. |
Definition at line 76 of file vector4i.c.
Returns a vector4i along the y-axis.
| y | The y component value. |
Definition at line 44 of file vector4i.c.
Returns a vector4i for scaling along the y-axis.
| y | The y scale factor. |
Definition at line 87 of file vector4i.c.
Returns a vector4i along the z-axis.
| z | The z component value. |
Definition at line 55 of file vector4i.c.
Returns a vector4i for scaling along the z-axis.
| z | The z scale factor. |
Definition at line 98 of file vector4i.c.
| vector4i vec4i_zero | ( | void | ) |
Returns a zero-initialized vector4i.
Definition at line 12 of file vector4i.c.