vector4i_ptr.c file
Functions
- void vec4i_add_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Adds the components of two
vector4iand stores the result in res. - void vec4i_sub_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Subtracts the components of the second vector from the first
vector4iand stores the result in res. -
void vec4i_mul_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_
int_ t s) - Multiplies the components of a
vector4iby a scalar and stores the result in res. -
void vec4i_div_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_
int_ t s) - Divides the components of a
vector4iby a scalar and stores the result in res. - void vec4i_mul_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Multiplies the components of two
vector4iand stores the result in res. - void vec4i_neg_ptr(vector4i* res, const vector4i* v)
- Negates the components of a
vector4iand stores the result in res. - void vec4i_abs_ptr(vector4i* res, const vector4i* v)
- Computes the absolute value of each component of a
vector4iand stores the result in res. - void vec4i_normalize_ptr(vector4i* res, const vector4i* v)
- Normalizes a
vector4iby dividing its components by the vector length and stores the result in res. - void vec4i_min_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Takes the component-wise minimum of two
vector4iand stores the result in res. - void vec4i_max_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Computes the component-wise maximum of two
vector4iand stores the result in res. - void vec4i_sign_ptr(vector4i* res, const vector4i* v)
- Computes the sign (-1, 0, or 1) of each component of a
vector4iand stores the result in res. -
void vec4i_lerp_ptr(vector4i* res,
const vector4i* a,
const vector4i* b,
const vm_
float_ t t) - Linearly interpolates between two
vector4iusing an interpolation factor t (clamped to [0,1]) and stores the result in res. - void vec4i_clamp_ptr(vector4i* res, const vector4i* v, const vector4i* min, const vector4i* max)
- Clamps the components of a
vector4ito the range [min, max] and stores the result in res. - void vec4i_to_vec3i_ptr(vector3i* res, const vector4i* v)
- Copies the x, y, z components of a
vector4iand stores the result in avector3i. -
static auto vm_div_floor4(const vm_
int_ t a, const vm_ int_ t b) -> vm_ int_ t - Floor division toward -inf; returns 0 if
b == 0. -
static auto vm_mod_floor4(const vm_
int_ t a, const vm_ int_ t b) -> vm_ int_ t - Floor modulo matching
vm_.div_ floor4 - void vec4i_div_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Divides two vectors component-wise.
-
void vec4i_add_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_
int_ t s) - Adds a scalar to each component.
-
void vec4i_sub_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_
int_ t s) - Subtracts a scalar from each component.
- void vec4i_mod_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Component-wise floor modulo of a by b.
- void vec4i_div_floor_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Component-wise floored division of a by b.
- void vec4i_wrap_ptr(vector4i* res, const vector4i* v, const vector4i* period)
- Wraps each component of v into [0, period).
Function documentation
void vec4i_add_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Adds the components of two vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| a | Pointer to first vector |
| b | Pointer to second vector |
void vec4i_sub_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Subtracts the components of the second vector from the first vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| a | Pointer to first vector |
| b | Pointer to second vector |
void vec4i_mul_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_ int_ t s)
Multiplies the components of a vector4i by a scalar and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
| s | Scalar value |
void vec4i_div_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_ int_ t s)
Divides the components of a vector4i by a scalar and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
| s | Scalar divisor |
If the scalar is zero, sets all components of res to zero.
void vec4i_mul_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Multiplies the components of two vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| a | Pointer to first vector |
| b | Pointer to second vector |
void vec4i_neg_ptr(vector4i* res, const vector4i* v)
Negates the components of a vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
void vec4i_abs_ptr(vector4i* res, const vector4i* v)
Computes the absolute value of each component of a vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
void vec4i_normalize_ptr(vector4i* res, const vector4i* v)
Normalizes a vector4i by dividing its components by the vector length and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
If the length is zero, copies the input vector to res.
void vec4i_min_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Takes the component-wise minimum of two vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| a | Pointer to first vector |
| b | Pointer to second vector |
void vec4i_max_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Computes the component-wise maximum of two vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| a | Pointer to first vector |
| b | Pointer to second vector |
void vec4i_sign_ptr(vector4i* res, const vector4i* v)
Computes the sign (-1, 0, or 1) of each component of a vector4i and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
void vec4i_lerp_ptr(vector4i* res,
const vector4i* a,
const vector4i* b,
const vm_ float_ t t)
Linearly interpolates between two vector4i using an interpolation factor t (clamped to [0,1]) and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| a | Pointer to first vector |
| b | Pointer to second vector |
| t | Interpolation factor |
void vec4i_clamp_ptr(vector4i* res, const vector4i* v, const vector4i* min, const vector4i* max)
Clamps the components of a vector4i to the range [min, max] and stores the result in res.
| Parameters | |
|---|---|
| res | Pointer to result vector |
| v | Pointer to input vector |
| min | Pointer to minimum bounds vector |
| max | Pointer to maximum bounds vector |
static vm_ int_ t vm_div_floor4(const vm_ int_ t a,
const vm_ int_ t b)
Floor division toward -inf; returns 0 if b == 0.
| Parameters | |
|---|---|
| a | Dividend. |
| b | Divisor. |
| Returns | floor(a / b), or 0 if b is 0. |
static vm_ int_ t vm_mod_floor4(const vm_ int_ t a,
const vm_ int_ t b)
Floor modulo matching vm_.
| Parameters | |
|---|---|
| a | Dividend. |
| b | Divisor. |
| Returns | Floor modulus. |
void vec4i_div_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Divides two vectors component-wise.
| Parameters | |
|---|---|
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
void vec4i_add_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_ int_ t s)
Adds a scalar to each component.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
void vec4i_sub_scalar_ptr(vector4i* res,
const vector4i* v,
const vm_ int_ t s)
Subtracts a scalar from each component.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
void vec4i_mod_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Component-wise floor modulo of a by b.
| Parameters | |
|---|---|
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
void vec4i_div_floor_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Component-wise floored division of a by b.
| Parameters | |
|---|---|
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
void vec4i_wrap_ptr(vector4i* res, const vector4i* v, const vector4i* period)
Wraps each component of v into [0, period).
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| period | Wrap period per component. |