|
Vecmat 0.2.3
C math and linear algebra library for 2D/3D graphics, physics, and science.
|
Go to the source code of this file.
Functions | |
| void | vec3i_add_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Computes the component-wise sum of two vector3i. | |
| void | vec3i_sub_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Computes the component-wise difference of two vector3i (a minus b). | |
| void | vec3i_mul_scalar_ptr (vector3i *res, const vector3i *v, const vm_int_t s) |
| Scales a vector3i by an integer scalar. | |
| void | vec3i_div_scalar_ptr (vector3i *res, const vector3i *v, const vm_int_t s) |
| Scales a vector3i by the inverse of an integer scalar. | |
| void | vec3i_mul_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Computes the component-wise product (Hadamard) of two vector3i. | |
| void | vec3i_neg_ptr (vector3i *res, const vector3i *v) |
| Negates a vector3i (multiplies by -1). | |
| void | vec3i_abs_ptr (vector3i *res, const vector3i *v) |
| Computes the absolute value of each component of a vector3i. | |
| void | vec3i_normalize_ptr (vector3i *res, const vector3i *v) |
| Normalizes a vector3i to approximate unit length. | |
| void | vec3i_cross_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Computes the cross-product of two vector3i. | |
| void | vec3i_min_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Computes the component-wise minimum of two vector3i. | |
| void | vec3i_max_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Computes the component-wise maximum of two vector3i. | |
| void | vec3i_sign_ptr (vector3i *res, const vector3i *v) |
| Computes the sign of each component of a vector3i (-1, 0, or 1). | |
| void | vec3i_lerp_ptr (vector3i *res, const vector3i *a, const vector3i *b, const vm_float_t t) |
| Performs linear interpolation between two vector3i. | |
| void | vec3i_clamp_ptr (vector3i *res, const vector3i *v, const vector3i *min, const vector3i *max) |
| Clamps each component of a vector3i between corresponding min and max values. | |
| static vm_int_t | vm_div_floor3 (const vm_int_t a, const vm_int_t b) |
| static vm_int_t | vm_mod_floor3 (const vm_int_t a, const vm_int_t b) |
| void | vec3i_div_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Divides two vectors component-wise. | |
| void | vec3i_add_scalar_ptr (vector3i *res, const vector3i *v, const vm_int_t s) |
| Adds a scalar to each component. | |
| void | vec3i_sub_scalar_ptr (vector3i *res, const vector3i *v, const vm_int_t s) |
| Subtracts a scalar from each component. | |
| void | vec3i_mod_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Component-wise floor modulo of a by b. | |
| void | vec3i_div_floor_ptr (vector3i *res, const vector3i *a, const vector3i *b) |
| Component-wise floored division of a by b. | |
| void | vec3i_wrap_ptr (vector3i *res, const vector3i *v, const vector3i *period) |
| Wraps each component of v into [0, period). | |
| void | vec3i_from_vec2i_ptr (vector3i *res, const vector2i *v, const vm_int_t z) |
| Builds a vector3i from a vector2i and z. | |
| void | vec3i_xy_ptr (vector2i *res, const vector3i *v) |
| Returns the x and y components as a 2D vector. | |
| void | vec3i_normalize_to_vec3_ptr (vector3 *res, const vector3i *v) |
| Converts to a unit-length vector3. | |
Computes the absolute value of each component of a vector3i.
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
Definition at line 105 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_abs().
Computes the component-wise sum of two vector3i.
| res | Pointer to the vector that will store the result. |
| a | Pointer to the first vector. |
| b | Pointer to the second vector. |
Definition at line 15 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_add().
Adds a scalar to each component.
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
Definition at line 267 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_add_scalar().
| void vec3i_clamp_ptr | ( | vector3i * | res, |
| const vector3i * | v, | ||
| const vector3i * | min, | ||
| const vector3i * | max ) |
Clamps each component of a vector3i between corresponding min and max values.
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
| min | Pointer to the minimum bounds vector. |
| max | Pointer to the maximum bounds vector. |
Definition at line 212 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_clamp().
Computes the cross-product of two vector3i.
| res | Pointer to the vector that will store the result. |
| a | Pointer to the first vector. |
| b | Pointer to the second vector. |
Definition at line 140 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_cross().
Component-wise floored division of a by b.
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
Definition at line 309 of file vector3i_ptr.c.
References vm_div_floor3(), vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_div_floor().
Divides two vectors component-wise.
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
Definition at line 253 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_div().
Scales a vector3i by the inverse of an integer scalar.
If the scalar is zero, stores the zero vector.
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
| s | The scalar divisor. |
Definition at line 59 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_div_scalar().
Builds a vector3i from a vector2i and z.
| res | Output vector. |
| v | Input vector. |
| z | Z component. |
Definition at line 337 of file vector3i_ptr.c.
References vector2i::x, vector3i::x, vector2i::y, vector3i::y, and vector3i::z.
Referenced by vec3i_from_vec2i().
| void vec3i_lerp_ptr | ( | vector3i * | res, |
| const vector3i * | a, | ||
| const vector3i * | b, | ||
| const vm_float_t | t ) |
Performs linear interpolation between two vector3i.
| res | Pointer to the vector that will store the result. |
| a | Pointer to the start vector. |
| b | Pointer to the end vector. |
| t | Interpolation factor (typically between 0.0 and 1.0). |
Definition at line 196 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_lerp().
Computes the component-wise maximum of two vector3i.
| res | Pointer to the vector that will store the result. |
| a | Pointer to the first vector. |
| b | Pointer to the second vector. |
Definition at line 168 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_max().
Computes the component-wise minimum of two vector3i.
| res | Pointer to the vector that will store the result. |
| a | Pointer to the first vector. |
| b | Pointer to the second vector. |
Definition at line 154 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_min().
Component-wise floor modulo of a by b.
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
Definition at line 295 of file vector3i_ptr.c.
References vm_mod_floor3(), vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_mod().
Computes the component-wise product (Hadamard) of two vector3i.
| res | Pointer to the vector that will store the result. |
| a | Pointer to the first vector. |
| b | Pointer to the second vector. |
Definition at line 79 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_mul().
Scales a vector3i by an integer scalar.
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
| s | The scalar multiplier. |
Definition at line 43 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_mul_scalar().
Negates a vector3i (multiplies by -1).
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
Definition at line 92 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_neg().
Normalizes a vector3i to approximate unit length.
If the vector length is zero, copies the input vector.
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
Definition at line 120 of file vector3i_ptr.c.
References vec3i_length(), vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_normalize().
Converts to a unit-length vector3.
| res | Output vector. |
| v | Input vector. |
Definition at line 362 of file vector3i_ptr.c.
References vec3_normalize_ptr(), vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_normalize_to_vec3().
Computes the sign of each component of a vector3i (-1, 0, or 1).
| res | Pointer to the vector that will store the result. |
| v | Pointer to the input vector. |
Definition at line 181 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_sign().
Computes the component-wise difference of two vector3i (a minus b).
| res | Pointer to the vector that will store the result. |
| a | Pointer to the first vector. |
| b | Pointer to the second vector. |
Definition at line 29 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_sub().
Subtracts a scalar from each component.
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
Definition at line 281 of file vector3i_ptr.c.
References vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_sub_scalar().
Wraps each component of v into [0, period).
| res | Output vector. |
| v | Input vector. |
| period | Wrap period per component. |
Definition at line 323 of file vector3i_ptr.c.
References vm_mod_floor3(), vector3i::x, vector3i::y, and vector3i::z.
Referenced by vec3i_wrap().
Returns the x and y components as a 2D vector.
| res | Output vector. |
| v | Input vector. |
Definition at line 350 of file vector3i_ptr.c.
References vector2i::x, vector3i::x, vector2i::y, and vector3i::y.
Referenced by vec3i_xy().
Definition at line 220 of file vector3i_ptr.c.
Referenced by vec3i_div_floor_ptr().
Definition at line 234 of file vector3i_ptr.c.
Referenced by vec3i_mod_ptr(), and vec3i_wrap_ptr().