|
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 | |
| vector3i | vec3i_zero (void) |
| Returns a zero-initialized vector3i. | |
| vector3i | vec3i_one (void) |
| Returns a vector3i with all components set to 1. | |
| vector3i | vec3i_x_axis (const vm_int_t x) |
| Returns a vector3i along the x-axis. | |
| vector3i | vec3i_y_axis (const vm_int_t y) |
| Returns a vector3i along the y-axis. | |
| vector3i | vec3i_z_axis (const vm_int_t z) |
| Returns a vector3i along the z-axis. | |
| vector3i | vec3i_x_scale (const vm_int_t x) |
| Returns a vector3i for scaling along the x-axis. | |
| vector3i | vec3i_y_scale (const vm_int_t y) |
| Returns a vector3i for scaling along the y-axis. | |
| vector3i | vec3i_z_scale (const vm_int_t z) |
| Returns a vector3i for scaling along the z-axis. | |
| vector3i | vec3i_add (const vector3i a, const vector3i b) |
| Component-wise addition of two vectors. | |
| vector3i | vec3i_sub (const vector3i a, const vector3i b) |
| Component-wise subtraction of two vectors. | |
| vector3i | vec3i_mul_scalar (const vector3i v, const vm_int_t s) |
| Component-wise multiplication of vector by scalar. | |
| vector3i | vec3i_div_scalar (const vector3i v, const vm_int_t s) |
| Component-wise division of vector by scalar. | |
| vector3i | vec3i_mul (const vector3i a, const vector3i b) |
| Component-wise multiplication of two vectors. | |
| vector3i | vec3i_neg (const vector3i v) |
| Negation of a vector. | |
| vector3i | vec3i_abs (const vector3i v) |
| Computes the absolute value per component of a vector3i. | |
| vector3i | vec3i_cross (const vector3i a, const vector3i b) |
| Computes the cross-product of two vector3i. | |
| vector3i | vec3i_normalize (const vector3i v) |
| Normalizes a vector3i to unit length. | |
| vector3i | vec3i_min (const vector3i a, const vector3i b) |
| Computes the component-wise minimum of two vector3i. | |
| vector3i | vec3i_max (const vector3i a, const vector3i b) |
| Computes the component-wise maximum of two vector3i. | |
| vector3i | vec3i_sign (const vector3i v) |
| Computes the sign per component of a vector3i (-1, 0, or 1). | |
| vector3i | vec3i_lerp (const vector3i a, const vector3i b, const vm_float_t t) |
| Linearly interpolates between two vector3i. | |
| vector3i | vec3i_clamp (const vector3i v, const vector3i min, const vector3i max) |
| Clamps a vector3i between min and max per component. | |
| vm_int_t | vec3i_dot (const vector3i a, const vector3i b) |
| Computes the dot product of two vector3i. | |
| vm_float_t | vec3i_length (const vector3i v) |
| Computes the length (magnitude) of a vector3i. | |
| vm_float_t | vec3i_distance (const vector3i a, const vector3i b) |
| Computes the Euclidean distance between two vector3i. | |
| vm_float_t | vec3i_angle (const vector3i a, const vector3i b) |
| Computes the angle between two non-zero vector3i in radians. | |
| vector3i | vec3i_div (const vector3i a, const vector3i b) |
| Divides two vectors component-wise. | |
| vector3i | vec3i_add_scalar (const vector3i v, const vm_int_t s) |
| Adds a scalar to each component. | |
| vector3i | vec3i_sub_scalar (const vector3i v, const vm_int_t s) |
| Subtracts a scalar from each component. | |
| vector3i | vec3i_mod (const vector3i a, const vector3i b) |
| Component-wise floor modulo of a by b. | |
| vector3i | vec3i_div_floor (const vector3i a, const vector3i b) |
| Component-wise floored division of a by b. | |
| vector3i | vec3i_wrap (const vector3i v, const vector3i period) |
| Wraps each component of v into [0, period). | |
| vector3i | vec3i_splat (const vm_int_t s) |
| Returns a vector with every component set to s. | |
| vector3i | vec3i_from_vec2i (const vector2i v, const vm_int_t z) |
| Builds a vector3i from a vector2i and z. | |
| vector2i | vec3i_xy (const vector3i v) |
| Returns the x and y components as a 2D vector. | |
| vector3 | vec3i_normalize_to_vec3 (const vector3i v) |
| Converts to a unit-length vector3. | |
| vm_int_t | vec3i_length_squared (const vector3i v) |
| Returns the squared Euclidean length. | |
| vm_int_t | vec3i_distance_squared (const vector3i a, const vector3i b) |
| Returns the squared Euclidean distance between a and b. | |
| vm_int_t | vec3i_length_manhattan (const vector3i v) |
| Returns the Manhattan (L1) length. | |
| vm_int_t | vec3i_length_chebyshev (const vector3i v) |
| Returns the Chebyshev (L-inf) length. | |
| vm_int_t | vec3i_min_component (const vector3i v) |
| Returns the smallest component. | |
| vm_int_t | vec3i_max_component (const vector3i v) |
| Returns the largest component. | |
| vm_int_t | vec3i_sum (const vector3i v) |
| Returns the sum of all components. | |
| bool | vec3i_is_zero (const vector3i v) |
| Returns true if every component is zero. | |
Computes the absolute value per component of a vector3i.
See vec3i_abs_ptr for the out-parameter version.
| v | The vector. |
Definition at line 196 of file vector3i.c.
References vec3i_abs_ptr().
Component-wise addition of two vectors.
See vec3i_add_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 102 of file vector3i.c.
References vec3i_add_ptr().
Adds a scalar to each component.
See vec3i_add_scalar_ptr instead.
| v | Input vector. |
| s | Scalar value. |
Definition at line 390 of file vector3i.c.
References vec3i_add_scalar_ptr().
| vm_float_t vec3i_angle | ( | const vector3i | a, |
| const vector3i | b ) |
Computes the angle between two non-zero vector3i in radians.
| a | First vector. |
| b | Second vector. |
Definition at line 356 of file vector3i.c.
References vec3i_dot(), vec3i_length(), and VECMAT_ACOS.
Clamps a vector3i between min and max per component.
See vec3i_clamp_ptr for the out-parameter version.
| v | The vector. |
| min | Minimum bounds. |
| max | Maximum bounds. |
Definition at line 308 of file vector3i.c.
References vec3i_clamp_ptr().
Computes the cross-product of two vector3i.
See vec3i_cross_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 212 of file vector3i.c.
References vec3i_cross_ptr().
| vm_float_t vec3i_distance | ( | const vector3i | a, |
| const vector3i | b ) |
Computes the Euclidean distance between two vector3i.
| a | First vector. |
| b | Second vector. |
Definition at line 344 of file vector3i.c.
References vec3i_length(), and vec3i_sub().
Returns the squared Euclidean distance between a and b.
| a | First input vector. |
| b | Second input vector. |
Definition at line 538 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Divides two vectors component-wise.
See vec3i_div_ptr instead.
| a | First input vector. |
| b | Second input vector. |
Definition at line 374 of file vector3i.c.
References vec3i_div_ptr().
Component-wise floored division of a by b.
See vec3i_div_floor_ptr instead.
| a | First input vector. |
| b | Second input vector. |
Definition at line 438 of file vector3i.c.
References vec3i_div_floor_ptr().
Component-wise division of vector by scalar.
See vec3i_div_scalar_ptr for the out-parameter version.
| v | The vector. |
| s | The scalar (non-zero). |
Definition at line 150 of file vector3i.c.
References vec3i_div_scalar_ptr().
Computes the dot product of two vector3i.
| a | First vector. |
| b | Second vector. |
Definition at line 322 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_angle(), vec3i_length(), and vec3i_length_squared().
Builds a vector3i from a vector2i and z.
See vec3i_from_vec2i_ptr instead.
| v | Input vector. |
| z | Z component. |
Definition at line 483 of file vector3i.c.
References vec3i_from_vec2i_ptr().
| bool vec3i_is_zero | ( | const vector3i | v | ) |
Returns true if every component is zero.
| v | Input vector. |
Definition at line 616 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
| vm_float_t vec3i_length | ( | const vector3i | v | ) |
Computes the length (magnitude) of a vector3i.
| v | The vector. |
Definition at line 333 of file vector3i.c.
References vec3i_dot(), and VECMAT_SQRT.
Referenced by vec3i_angle(), vec3i_distance(), and vec3i_normalize_ptr().
Returns the Chebyshev (L-inf) length.
| v | Input vector. |
Definition at line 566 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Returns the Manhattan (L1) length.
| v | Input vector. |
Definition at line 552 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Returns the squared Euclidean length.
| v | Input vector. |
Definition at line 526 of file vector3i.c.
References vec3i_dot().
| vector3i vec3i_lerp | ( | const vector3i | a, |
| const vector3i | b, | ||
| const vm_float_t | t ) |
Linearly interpolates between two vector3i.
See vec3i_lerp_ptr for the out-parameter version.
| a | Start vector. |
| b | End vector. |
| t | Interpolation factor [0, 1]. |
Definition at line 291 of file vector3i.c.
References vec3i_lerp_ptr().
Computes the component-wise maximum of two vector3i.
See vec3i_max_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 259 of file vector3i.c.
References vec3i_max_ptr().
Returns the largest component.
| v | Input vector. |
Definition at line 593 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Computes the component-wise minimum of two vector3i.
See vec3i_min_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 243 of file vector3i.c.
References vec3i_min_ptr().
Returns the smallest component.
| v | Input vector. |
Definition at line 581 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Component-wise floor modulo of a by b.
See vec3i_mod_ptr instead.
| a | First input vector. |
| b | Second input vector. |
Definition at line 422 of file vector3i.c.
References vec3i_mod_ptr().
Component-wise multiplication of two vectors.
See vec3i_mul_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 166 of file vector3i.c.
References vec3i_mul_ptr().
Component-wise multiplication of vector by scalar.
See vec3i_mul_scalar_ptr for the out-parameter version.
| v | The vector. |
| s | The scalar. |
Definition at line 134 of file vector3i.c.
References vec3i_mul_scalar_ptr().
Negation of a vector.
See vec3i_neg_ptr for the out-parameter version.
| v | The vector. |
Definition at line 181 of file vector3i.c.
References vec3i_neg_ptr().
Normalizes a vector3i to unit length.
See vec3i_normalize_ptr for the out-parameter version.
| v | The vector (non-zero). |
Definition at line 227 of file vector3i.c.
References vec3i_normalize_ptr().
Converts to a unit-length vector3.
See vec3i_normalize_to_vec3_ptr instead.
| v | Input vector. |
Definition at line 513 of file vector3i.c.
References vec3i_normalize_to_vec3_ptr().
| vector3i vec3i_one | ( | void | ) |
Returns a vector3i with all components set to 1.
Definition at line 22 of file vector3i.c.
Computes the sign per component of a vector3i (-1, 0, or 1).
See vec3i_sign_ptr for the out-parameter version.
| v | The vector. |
Definition at line 274 of file vector3i.c.
References vec3i_sign_ptr().
Returns a vector with every component set to s.
See vec3i_splat_ptr instead.
| s | Scalar value. |
Definition at line 469 of file vector3i.c.
Component-wise subtraction of two vectors.
See vec3i_sub_ptr for the out-parameter version.
| a | First vector. |
| b | Second vector. |
Definition at line 118 of file vector3i.c.
References vec3i_sub_ptr().
Referenced by vec3i_distance().
Subtracts a scalar from each component.
See vec3i_sub_scalar_ptr instead.
| v | Input vector. |
| s | Scalar value. |
Definition at line 406 of file vector3i.c.
References vec3i_sub_scalar_ptr().
Returns the sum of all components.
| v | Input vector. |
Definition at line 605 of file vector3i.c.
References vector3i::x, vector3i::y, and vector3i::z.
Wraps each component of v into [0, period).
See vec3i_wrap_ptr instead.
| v | Input vector. |
| period | Wrap period per component. |
Definition at line 454 of file vector3i.c.
References vec3i_wrap_ptr().
Returns a vector3i along the x-axis.
| x | The x component value. |
Definition at line 33 of file vector3i.c.
Returns a vector3i for scaling along the x-axis.
| x | The x scale factor. |
Definition at line 66 of file vector3i.c.
Returns the x and y components as a 2D vector.
See vec3i_xy_ptr instead.
| v | Input vector. |
Definition at line 498 of file vector3i.c.
References vec3i_xy_ptr().
Returns a vector3i along the y-axis.
| y | The y component value. |
Definition at line 44 of file vector3i.c.
Returns a vector3i for scaling along the y-axis.
| y | The y scale factor. |
Definition at line 77 of file vector3i.c.
Returns a vector3i along the z-axis.
| z | The z component value. |
Definition at line 55 of file vector3i.c.
Returns a vector3i for scaling along the z-axis.
| z | The z scale factor. |
Definition at line 88 of file vector3i.c.
| vector3i vec3i_zero | ( | void | ) |
Returns a zero-initialized vector3i.
Definition at line 12 of file vector3i.c.