vector4i.c file
Functions
- auto vec4i_zero(void) -> vector4i
- Returns a zero-initialized
vector4i. - auto vec4i_one(void) -> vector4i
- Returns a
vector4iwith all components set to 1. -
auto vec4i_x_axis(const vm_
int_ t x) -> vector4i - Returns a
vector4ialong the x-axis. -
auto vec4i_y_axis(const vm_
int_ t y) -> vector4i - Returns a
vector4ialong the y-axis. -
auto vec4i_z_axis(const vm_
int_ t z) -> vector4i - Returns a
vector4ialong the z-axis. -
auto vec4i_w_axis(const vm_
int_ t w) -> vector4i - Returns a
vector4ialong the w-axis. -
auto vec4i_x_scale(const vm_
int_ t x) -> vector4i - Returns a
vector4ifor scaling along the x-axis. -
auto vec4i_y_scale(const vm_
int_ t y) -> vector4i - Returns a
vector4ifor scaling along the y-axis. -
auto vec4i_z_scale(const vm_
int_ t z) -> vector4i - Returns a
vector4ifor scaling along the z-axis. -
auto vec4i_w_scale(const vm_
int_ t w) -> vector4i - Returns a
vector4ifor scaling along the w-axis. - auto vec4i_add(const vector4i a, const vector4i b) -> vector4i
- Component-wise addition of two vectors.
- auto vec4i_sub(const vector4i a, const vector4i b) -> vector4i
- Component-wise subtraction of two vectors.
-
auto vec4i_mul_scalar(const vector4i v,
const vm_
int_ t s) -> vector4i - Component-wise multiplication of vector by scalar.
-
auto vec4i_div_scalar(const vector4i v,
const vm_
int_ t s) -> vector4i - Component-wise division of vector by scalar.
- auto vec4i_mul(const vector4i a, const vector4i b) -> vector4i
- Component-wise multiplication of two vectors.
- auto vec4i_neg(const vector4i v) -> vector4i
- Negation of a vector.
- auto vec4i_abs(const vector4i v) -> vector4i
- Computes the absolute value per component of a
vector4i. - auto vec4i_normalize(const vector4i v) -> vector4i
- Normalizes a
vector4ito unit length. - auto vec4i_min(const vector4i a, const vector4i b) -> vector4i
- Computes the component-wise minimum of two
vector4i. - auto vec4i_max(const vector4i a, const vector4i b) -> vector4i
- Computes the component-wise maximum of two vector4i.
- auto vec4i_sign(const vector4i v) -> vector4i
- Computes the sign per component of a
vector4i(-1, 0, or 1). -
auto vec4i_lerp(const vector4i a,
const vector4i b,
const vm_
float_ t t) -> vector4i - Linearly interpolates between two
vector4i. - auto vec4i_clamp(const vector4i v, const vector4i min, const vector4i max) -> vector4i
- Clamps each component of the input vector to the range defined by the minimum and maximum vectors.
-
auto vec4i_dot(const vector4i a,
const vector4i b) -> vm_
int_ t - Computes the dot product of two
vector4i. -
auto vec4i_length(const vector4i v) -> vm_
float_ t - Computes the length (magnitude) of a
vector4i. -
auto vec4i_distance(const vector4i a,
const vector4i b) -> vm_
float_ t - Computes the Euclidean distance between two
vector4i. - auto vec4i_to_vec3i(const vector4i v) -> vector3i
- Converts a
vector4ito avector3i(discards the w component). - auto vec4i_div(const vector4i a, const vector4i b) -> vector4i
- Divides two vectors component-wise.
-
auto vec4i_add_scalar(const vector4i v,
const vm_
int_ t s) -> vector4i - Adds a scalar to each component.
-
auto vec4i_sub_scalar(const vector4i v,
const vm_
int_ t s) -> vector4i - Subtracts a scalar from each component.
- auto vec4i_mod(const vector4i a, const vector4i b) -> vector4i
- Component-wise floor modulo of a by b.
- auto vec4i_div_floor(const vector4i a, const vector4i b) -> vector4i
- Component-wise floored division of a by b.
- auto vec4i_wrap(const vector4i v, const vector4i period) -> vector4i
- Wraps each component of v into [0, period).
-
auto vec4i_splat(const vm_
int_ t s) -> vector4i - Returns a vector with every component set to s.
-
auto vec4i_length_squared(const vector4i v) -> vm_
int_ t - Returns the squared Euclidean length.
-
auto vec4i_distance_squared(const vector4i a,
const vector4i b) -> vm_
int_ t - Returns the squared Euclidean distance between a and b.
-
auto vec4i_length_manhattan(const vector4i v) -> vm_
int_ t - Returns the Manhattan (L1) length.
-
auto vec4i_length_chebyshev(const vector4i v) -> vm_
int_ t - Returns the Chebyshev (L-inf) length.
-
auto vec4i_min_component(const vector4i v) -> vm_
int_ t - Returns the smallest component.
-
auto vec4i_max_component(const vector4i v) -> vm_
int_ t - Returns the largest component.
-
auto vec4i_sum(const vector4i v) -> vm_
int_ t - Returns the sum of all components.
- auto vec4i_is_zero(const vector4i v) -> bool
- Returns true if every component is zero.
Function documentation
vector4i vec4i_zero(void)
Returns a zero-initialized vector4i.
| Returns | A vector4i with all components set to 0. |
|---|
vector4i vec4i_x_axis(const vm_ int_ t x)
Returns a vector4i along the x-axis.
| Parameters | |
|---|---|
| x | The x component value. |
| Returns | A vector4i with (x, 0, 0, 0). |
vector4i vec4i_y_axis(const vm_ int_ t y)
Returns a vector4i along the y-axis.
| Parameters | |
|---|---|
| y | The y component value. |
| Returns | A vector4i with (0, y, 0, 0). |
vector4i vec4i_z_axis(const vm_ int_ t z)
Returns a vector4i along the z-axis.
| Parameters | |
|---|---|
| z | The z component value. |
| Returns | A vector4i with (0, 0, z, 0). |
vector4i vec4i_w_axis(const vm_ int_ t w)
Returns a vector4i along the w-axis.
| Parameters | |
|---|---|
| w | The w component value. |
| Returns | A vector4i with (0, 0, 0, w). |
vector4i vec4i_x_scale(const vm_ int_ t x)
Returns a vector4i for scaling along the x-axis.
| Parameters | |
|---|---|
| x | The x scale factor. |
| Returns | A vector4i with (x, 1, 1, 1). |
vector4i vec4i_y_scale(const vm_ int_ t y)
Returns a vector4i for scaling along the y-axis.
| Parameters | |
|---|---|
| y | The y scale factor. |
| Returns | A vector4i with (1, y, 1, 1). |
vector4i vec4i_z_scale(const vm_ int_ t z)
Returns a vector4i for scaling along the z-axis.
| Parameters | |
|---|---|
| z | The z scale factor. |
| Returns | A vector4i with (1, 1, z, 1). |
vector4i vec4i_w_scale(const vm_ int_ t w)
Returns a vector4i for scaling along the w-axis.
| Parameters | |
|---|---|
| w | The w scale factor. |
| Returns | A vector4i with (1, 1, 1, w). |
vector4i vec4i_mul_scalar(const vector4i v,
const vm_ int_ t s)
Component-wise multiplication of vector by scalar.
| Parameters | |
|---|---|
| v | The vector. |
| s | The scalar. |
| Returns | Result vector. |
vector4i vec4i_div_scalar(const vector4i v,
const vm_ int_ t s)
Component-wise division of vector by scalar.
| Parameters | |
|---|---|
| v | The vector. |
| s | The scalar (non-zero). |
| Returns | Result vector. |
vector4i vec4i_normalize(const vector4i v)
Normalizes a vector4i to unit length.
| Parameters | |
|---|---|
| v | The vector (non-zero). |
| Returns | The normalized vector. |
vector4i vec4i_sign(const vector4i v)
Computes the sign per component of a vector4i (-1, 0, or 1).
| Parameters | |
|---|---|
| v | The vector. |
| Returns | The sign vector. |
vector4i vec4i_lerp(const vector4i a,
const vector4i b,
const vm_ float_ t t)
Linearly interpolates between two vector4i.
| Parameters | |
|---|---|
| a | Start vector. |
| b | End vector. |
| t | Interpolation factor [0, 1]. |
| Returns | The interpolated vector (a * (1 - t) + b * t). |
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.
| Parameters | |
|---|---|
| v | The input vector. |
| min | The minimum value for each component. |
| max | The maximum value for each component. |
| Returns | A new vector4i with each component clamped to [min, max]. |
vm_ float_ t vec4i_length(const vector4i v)
Computes the length (magnitude) of a vector4i.
| Parameters | |
|---|---|
| v | The vector. |
| Returns | The Euclidean length of v. |
vm_ float_ t vec4i_distance(const vector4i a,
const vector4i b)
Computes the Euclidean distance between two vector4i.
| Parameters | |
|---|---|
| a | First vector. |
| b | Second vector. |
| Returns | The distance between a and b. |
vector4i vec4i_add_scalar(const vector4i v,
const vm_ int_ t s)
Adds a scalar to each component.
| Parameters | |
|---|---|
| v | Input vector. |
| s | Scalar value. |
| Returns | The resulting vector4i. |
vector4i vec4i_sub_scalar(const vector4i v,
const vm_ int_ t s)
Subtracts a scalar from each component.
| Parameters | |
|---|---|
| v | Input vector. |
| s | Scalar value. |
| Returns | The resulting vector4i. |
vector4i vec4i_div_floor(const vector4i a, const vector4i b)
Component-wise floored division of a by b.
| Parameters | |
|---|---|
| a | First input vector. |
| b | Second input vector. |
| Returns | The resulting vector4i. |
vector4i vec4i_wrap(const vector4i v, const vector4i period)
Wraps each component of v into [0, period).
| Parameters | |
|---|---|
| v | Input vector. |
| period | Wrap period per component. |
| Returns | The resulting vector4i. |
vector4i vec4i_splat(const vm_ int_ t s)
Returns a vector with every component set to s.
| Parameters | |
|---|---|
| s | Scalar value. |
| Returns | The resulting vector4i. |
vm_ int_ t vec4i_length_squared(const vector4i v)
Returns the squared Euclidean length.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | The resulting scalar. |
vm_ int_ t vec4i_distance_squared(const vector4i a,
const vector4i b)
Returns the squared Euclidean distance between a and b.
| Parameters | |
|---|---|
| a | First input vector. |
| b | Second input vector. |
| Returns | The resulting scalar. |
vm_ int_ t vec4i_length_manhattan(const vector4i v)
Returns the Manhattan (L1) length.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | The resulting scalar. |
vm_ int_ t vec4i_length_chebyshev(const vector4i v)
Returns the Chebyshev (L-inf) length.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | The resulting scalar. |
vm_ int_ t vec4i_min_component(const vector4i v)
Returns the smallest component.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | The resulting scalar. |
vm_ int_ t vec4i_max_component(const vector4i v)
Returns the largest component.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | The resulting scalar. |
bool vec4i_is_zero(const vector4i v)
Returns true if every component is zero.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | True if every component is zero. |