|
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 | vec2i_add_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Adds vectors a and b component-wise, storing the result in res. | |
| void | vec2i_sub_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Subtracts vector b from vector a component-wise, storing the result in res. | |
| void | vec2i_mul_scalar_ptr (vector2i *res, const vector2i *v, const vm_int_t s) |
| Multiplies vector v by scalar s component-wise, storing the result in res. | |
| void | vec2i_div_scalar_ptr (vector2i *res, const vector2i *v, const vm_int_t s) |
| Divides vector v by scalar s component-wise (float division, truncated to int), storing the result in res. | |
| void | vec2i_mul_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Multiplies vectors a and b component-wise (Hadamard product), storing the result in res. | |
| void | vec2i_neg_ptr (vector2i *res, const vector2i *v) |
| Negates the components of vector v, storing the result in res. | |
| void | vec2i_abs_ptr (vector2i *res, const vector2i *v) |
| Computes the absolute values of the components of vector v (using int abs), storing the result in res. | |
| void | vec2i_normalize_ptr (vector2i *res, const vector2i *v) |
| Normalizes vector v to approximate unit length (float length computation, truncated to int), storing the result in res. | |
| void | vec2i_min_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Computes the component-wise minimum of vectors a and b, storing the result in res. | |
| void | vec2i_max_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Computes the component-wise maximum of vectors a and b, storing the result in res. | |
| void | vec2i_sign_ptr (vector2i *res, const vector2i *v) |
| Sets each component of res to the sign of the corresponding component in v (+1, -1, or 0). | |
| void | vec2i_perpendicular_ptr (vector2i *res, const vector2i *v) |
| Computes the perpendicular vector to v (90 degrees counterclockwise rotation), storing the result in res. | |
| void | vec2i_cross_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Computes the 2D cross-product of a and b, storing the scalar value in res->x and 0 in res->y. | |
| static vm_int_t | vm_div_floor (const vm_int_t a, const vm_int_t b) |
| static vm_int_t | vm_mod_floor (const vm_int_t a, const vm_int_t b) |
| void | vec2i_lerp_ptr (vector2i *res, const vector2i *a, const vector2i *b, const vm_float_t t) |
| Linearly interpolates from a to b by t. | |
| void | vec2i_clamp_ptr (vector2i *res, const vector2i *v, const vector2i *min, const vector2i *max) |
| Clamps each component between min and max. | |
| void | vec2i_div_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Divides two vectors component-wise. | |
| void | vec2i_add_scalar_ptr (vector2i *res, const vector2i *v, const vm_int_t s) |
| Adds a scalar to each component. | |
| void | vec2i_sub_scalar_ptr (vector2i *res, const vector2i *v, const vm_int_t s) |
| Subtracts a scalar from each component. | |
| void | vec2i_mod_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Component-wise floor modulo of a by b. | |
| void | vec2i_div_floor_ptr (vector2i *res, const vector2i *a, const vector2i *b) |
| Component-wise floored division of a by b. | |
| void | vec2i_wrap_ptr (vector2i *res, const vector2i *v, const vector2i *period) |
| Wraps each component of v into [0, period). | |
| void | vec2i_to_vec3i_ptr (vector3i *res, const vector2i *v, const vm_int_t z) |
| Converts a vector4i to a vector3i by dropping w. | |
| void | vec2i_normalize_to_vec2_ptr (vector2 *res, const vector2i *v) |
| Converts to a unit-length vector2. | |
Computes the absolute values of the components of vector v (using int abs), storing the result in res.
Definition at line 101 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_abs().
Adds vectors a and b component-wise, storing the result in res.
Definition at line 15 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_add().
Adds a scalar to each component.
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
Definition at line 270 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_add_scalar().
| void vec2i_clamp_ptr | ( | vector2i * | res, |
| const vector2i * | v, | ||
| const vector2i * | min, | ||
| const vector2i * | max ) |
Clamps each component between min and max.
| res | Output vector. |
| v | Input vector. |
| min | Lower bound. |
| max | Upper bound. |
Definition at line 244 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_clamp().
Computes the 2D cross-product of a and b, storing the scalar value in res->x and 0 in res->y.
Definition at line 189 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_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 vector2i_ptr.c.
References vm_div_floor(), vector2i::x, and vector2i::y.
Referenced by vec2i_div_floor().
Divides two vectors component-wise.
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
Definition at line 257 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_div().
Divides vector v by scalar s component-wise (float division, truncated to int), storing the result in res.
Sets vector to zero if s == 0.
Definition at line 57 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_div_scalar().
| void vec2i_lerp_ptr | ( | vector2i * | res, |
| const vector2i * | a, | ||
| const vector2i * | b, | ||
| const vm_float_t | t ) |
Linearly interpolates from a to b by t.
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
| t | Interpolation factor. |
Definition at line 230 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_lerp().
Computes the component-wise maximum of vectors a and b, storing the result in res.
Definition at line 149 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_max().
Computes the component-wise minimum of vectors a and b, storing the result in res.
Definition at line 135 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_min().
Component-wise floor modulo of a by b.
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
Definition at line 296 of file vector2i_ptr.c.
References vm_mod_floor(), vector2i::x, and vector2i::y.
Referenced by vec2i_mod().
Multiplies vectors a and b component-wise (Hadamard product), storing the result in res.
Definition at line 76 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_mul().
Multiplies vector v by scalar s component-wise, storing the result in res.
Definition at line 41 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_mul_scalar().
Negates the components of vector v, storing the result in res.
Definition at line 88 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_neg().
Normalizes vector v to approximate unit length (float length computation, truncated to int), storing the result in res.
Copies v unchanged if the length is zero.
Definition at line 116 of file vector2i_ptr.c.
References vec2i_length(), vector2i::x, and vector2i::y.
Referenced by vec2i_normalize().
Converts to a unit-length vector2.
| res | Output vector. |
| v | Input vector. |
Definition at line 348 of file vector2i_ptr.c.
References vec2_normalize_ptr(), vector2i::x, and vector2i::y.
Referenced by vec2i_normalize_to_vec2().
Computes the perpendicular vector to v (90 degrees counterclockwise rotation), storing the result in res.
Definition at line 175 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_perpendicular().
Sets each component of res to the sign of the corresponding component in v (+1, -1, or 0).
Definition at line 162 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_sign().
Subtracts vector b from vector a component-wise, storing the result in res.
Definition at line 28 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_sub().
Subtracts a scalar from each component.
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
Definition at line 283 of file vector2i_ptr.c.
References vector2i::x, and vector2i::y.
Referenced by vec2i_sub_scalar().
Converts a vector4i to a vector3i by dropping w.
| res | Output vector. |
| v | Input vector. |
| z | Z component. |
Definition at line 335 of file vector2i_ptr.c.
References vector2i::x, vector3i::x, vector2i::y, vector3i::y, and vector3i::z.
Referenced by vec2i_to_vec3i().
Wraps each component of v into [0, period).
| res | Output vector. |
| v | Input vector. |
| period | Wrap period per component. |
Definition at line 322 of file vector2i_ptr.c.
References vm_mod_floor(), vector2i::x, and vector2i::y.
Referenced by vec2i_wrap().
Definition at line 196 of file vector2i_ptr.c.
Referenced by vec2i_div_floor_ptr().
Definition at line 210 of file vector2i_ptr.c.
Referenced by vec2i_mod_ptr(), and vec2i_wrap_ptr().