14 return (
vector4i){.x = 0, .y = 0, .z = 0, .w = 0};
24 return (
vector4i){.x = 1, .y = 1, .z = 1, .w = 1};
35 return (
vector4i){.x = x, .y = 0, .z = 0, .w = 0};
46 return (
vector4i){.x = 0, .y = y, .z = 0, .w = 0};
56 return (
vector4i){.x = 0, .y = 0, .z = z, .w = 0};
67 return (
vector4i){.x = 0, .y = 0, .z = 0, .w = w};
78 return (
vector4i){.x = x, .y = 1, .z = 1, .w = 1};
89 return (
vector4i){.x = 1, .y = y, .z = 1, .w = 1};
100 return (
vector4i){.x = 1, .y = 1, .z = z, .w = 1};
111 return (
vector4i){.x = 1, .y = 1, .z = 1, .w = w};
330 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z + a.
w * b.
w;
476 return (
vector4i){.x = s, .y = s, .z = s, .w = s};
514 return ax + ay + az + aw;
544 if (v.
y < m) m = v.
y;
545 if (v.
z < m) m = v.
z;
546 if (v.
w < m) m = v.
w;
559 if (v.
y > m) m = v.
y;
560 if (v.
z > m) m = v.
z;
561 if (v.
w > m) m = v.
w;
573 return v.
x + v.
y + v.
z + v.
w;
584 return v.
x == 0 && v.
y == 0 && v.
z == 0 && v.
w == 0;
void vec4i_div_scalar_ptr(vector4i *res, const vector4i *v, vm_int_t s)
Divides the components of a vector4i by a scalar and stores the result in res.
void vec4i_lerp_ptr(vector4i *res, const vector4i *a, const vector4i *b, vm_float_t t)
Linearly interpolates between two vector4i using an interpolation factor t (clamped to [0,...
void vec4i_add_ptr(vector4i *res, const vector4i *a, const vector4i *b)
Adds the components of two vector4i and stores the result in res.
void vec4i_to_vec3i_ptr(vector3i *res, const vector4i *v)
Copies the x, y, z components of a vector4i and stores the result in a vector3i.
void vec4i_div_ptr(vector4i *res, const vector4i *a, const vector4i *b)
Divides two vectors component-wise.
void vec4i_mod_ptr(vector4i *res, const vector4i *a, const vector4i *b)
Component-wise floor modulo of a by b.
void vec4i_sub_scalar_ptr(vector4i *res, const vector4i *v, vm_int_t s)
Subtracts a scalar from each component.
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.
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.
void vec4i_mul_scalar_ptr(vector4i *res, const vector4i *v, vm_int_t s)
Multiplies the components of a vector4i by a scalar and stores the result in res.
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.
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.
void vec4i_mul_ptr(vector4i *res, const vector4i *a, const vector4i *b)
Multiplies the components of two vector4i and stores the result in res.
void vec4i_add_scalar_ptr(vector4i *res, const vector4i *v, vm_int_t s)
Adds a scalar to each component.
void vec4i_neg_ptr(vector4i *res, const vector4i *v)
Negates the components of a vector4i 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 vector4i and 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 vector4i and stores the result in res.
void vec4i_div_floor_ptr(vector4i *res, const vector4i *a, const vector4i *b)
Component-wise floored division of a by b.
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.
void vec4i_wrap_ptr(vector4i *res, const vector4i *v, const vector4i *period)
Wraps each component of v into [0, period).
vector4i vec4i_add_scalar(const vector4i v, const vm_int_t s)
Adds a scalar to each component.
bool vec4i_is_zero(const vector4i v)
Returns true if every component is zero.
vector4i vec4i_lerp(const vector4i a, const vector4i b, const vm_float_t t)
Linearly interpolates between two vector4i.
vector4i vec4i_z_scale(const vm_int_t z)
Returns a vector4i for scaling along the z-axis.
vm_float_t vec4i_length(const vector4i v)
Computes the length (magnitude) of a vector4i.
vector4i vec4i_y_axis(const vm_int_t y)
Returns a vector4i along the y-axis.
vector4i vec4i_splat(const vm_int_t s)
Returns a vector with every component set to s.
vector4i vec4i_w_axis(const vm_int_t w)
Returns a vector4i along the w-axis.
vector4i vec4i_div_scalar(const vector4i v, const vm_int_t s)
Component-wise division of vector by scalar.
vm_int_t vec4i_length_squared(const vector4i v)
Returns the squared Euclidean length.
vector4i vec4i_w_scale(const vm_int_t w)
Returns a vector4i for scaling along the w-axis.
vector4i vec4i_div(const vector4i a, const vector4i b)
Divides two vectors component-wise.
vm_int_t vec4i_length_chebyshev(const vector4i v)
Returns the Chebyshev (L-inf) length.
vector4i vec4i_x_scale(const vm_int_t x)
Returns a vector4i for scaling along the x-axis.
vector4i vec4i_max(const vector4i a, const vector4i b)
Computes the component-wise maximum of two vector4i.
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.
vector4i vec4i_one(void)
Returns a vector4i with all components set to 1.
vm_int_t vec4i_distance_squared(const vector4i a, const vector4i b)
Returns the squared Euclidean distance between a and b.
vector4i vec4i_sign(const vector4i v)
Computes the sign per component of a vector4i (-1, 0, or 1).
vm_int_t vec4i_length_manhattan(const vector4i v)
Returns the Manhattan (L1) length.
vector4i vec4i_min(const vector4i a, const vector4i b)
Computes the component-wise minimum of two vector4i.
vector3i vec4i_to_vec3i(const vector4i v)
Converts a vector4i to a vector3i (discards the w component).
vm_float_t vec4i_distance(const vector4i a, const vector4i b)
Computes the Euclidean distance between two vector4i.
vector4i vec4i_abs(const vector4i v)
Computes the absolute value per component of a vector4i.
vector4i vec4i_mul_scalar(const vector4i v, const vm_int_t s)
Component-wise multiplication of vector by scalar.
vector4i vec4i_div_floor(const vector4i a, const vector4i b)
Component-wise floored division of a by b.
vector4i vec4i_neg(const vector4i v)
Negation of a vector.
vm_int_t vec4i_min_component(const vector4i v)
Returns the smallest component.
vector4i vec4i_x_axis(const vm_int_t x)
Returns a vector4i along the x-axis.
vector4i vec4i_mul(const vector4i a, const vector4i b)
Component-wise multiplication of two vectors.
vector4i vec4i_sub_scalar(const vector4i v, const vm_int_t s)
Subtracts a scalar from each component.
vector4i vec4i_wrap(const vector4i v, const vector4i period)
Wraps each component of v into [0, period).
vm_int_t vec4i_max_component(const vector4i v)
Returns the largest component.
vector4i vec4i_add(const vector4i a, const vector4i b)
Component-wise addition of two vectors.
vector4i vec4i_y_scale(const vm_int_t y)
Returns a vector4i for scaling along the y-axis.
vector4i vec4i_mod(const vector4i a, const vector4i b)
Component-wise floor modulo of a by b.
vector4i vec4i_zero(void)
Returns a zero-initialized vector4i.
vm_int_t vec4i_sum(const vector4i v)
Returns the sum of all components.
vector4i vec4i_z_axis(const vm_int_t z)
Returns a vector4i along the z-axis.
vm_int_t vec4i_dot(const vector4i a, const vector4i b)
Computes the dot product of two vector4i.
vector4i vec4i_sub(const vector4i a, const vector4i b)
Component-wise subtraction of two vectors.
vector4i vec4i_normalize(const vector4i v)
Normalizes a vector4i to unit length.