14 return (
vector3i){.x = 0, .y = 0, .z = 0};
24 return (
vector3i){.x = 1, .y = 1, .z = 1};
35 return (
vector3i){.x = x, .y = 0, .z = 0};
46 return (
vector3i){.x = 0, .y = y, .z = 0};
57 return (
vector3i){.x = 0, .y = 0, .z = z};
68 return (
vector3i){.x = x, .y = 1, .z = 1};
79 return (
vector3i){.x = 1, .y = y, .z = 1};
90 return (
vector3i){.x = 1, .y = 1, .z = z};
324 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
361 if (len_a == 0.0f || len_b == 0.0f)
return 0.0f;
471 return (
vector3i){.x = s, .y = s, .z = s};
543 return dx * dx + dy * dy + dz * dz;
571 const vm_int_t m = ax > ay ? ax : ay;
572 return m > az ? m : az;
584 return m < v.
z ? m : v.
z;
596 return m > v.
z ? m : v.
z;
607 return v.
x + v.
y + v.
z;
618 return v.
x == 0 && v.
y == 0 && v.
z == 0;
void vec3i_cross_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Computes the cross-product of two vector3i.
void vec3i_wrap_ptr(vector3i *res, const vector3i *v, const vector3i *period)
Wraps each component of v into [0, period).
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.
void vec3i_mod_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Component-wise floor modulo of a by b.
void vec3i_add_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Computes the component-wise sum 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_normalize_ptr(vector3i *res, const vector3i *v)
Normalizes a vector3i to approximate unit length.
void vec3i_max_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Computes the component-wise maximum of two vector3i.
void vec3i_div_floor_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Component-wise floored division of a by b.
void vec3i_abs_ptr(vector3i *res, const vector3i *v)
Computes the absolute value of each component of a vector3i.
void vec3i_div_scalar_ptr(vector3i *res, const vector3i *v, vm_int_t s)
Scales a vector3i by the inverse of an integer scalar.
void vec3i_from_vec2i_ptr(vector3i *res, const vector2i *v, vm_int_t z)
Builds a vector3i from a vector2i and z.
void vec3i_mul_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Computes the component-wise product (Hadamard) of two vector3i.
void vec3i_xy_ptr(vector2i *res, const vector3i *v)
Returns the x and y components as a 2D vector.
void vec3i_add_scalar_ptr(vector3i *res, const vector3i *v, vm_int_t s)
Adds a scalar to each component.
void vec3i_div_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Divides two vectors component-wise.
void vec3i_mul_scalar_ptr(vector3i *res, const vector3i *v, vm_int_t s)
Scales a vector3i by an integer scalar.
void vec3i_lerp_ptr(vector3i *res, const vector3i *a, const vector3i *b, vm_float_t t)
Performs linear interpolation between two vector3i.
void vec3i_min_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Computes the component-wise minimum of two vector3i.
void vec3i_neg_ptr(vector3i *res, const vector3i *v)
Negates a vector3i (multiplies by -1).
void vec3i_sub_scalar_ptr(vector3i *res, const vector3i *v, vm_int_t s)
Subtracts a scalar from each component.
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_normalize_to_vec3_ptr(vector3 *res, const vector3i *v)
Converts to a unit-length vector3.
vector3i vec3i_y_axis(const vm_int_t y)
Returns a vector3i along the y-axis.
vector3i vec3i_normalize(const vector3i v)
Normalizes a vector3i to unit length.
vector3i vec3i_lerp(const vector3i a, const vector3i b, const vm_float_t t)
Linearly interpolates between two vector3i.
vector3i vec3i_one(void)
Returns a vector3i with all components set to 1.
vector3 vec3i_normalize_to_vec3(const vector3i v)
Converts to a unit-length vector3.
vector3i vec3i_cross(const vector3i a, const vector3i b)
Computes the cross-product of two vector3i.
vector3i vec3i_sub(const vector3i a, const vector3i b)
Component-wise subtraction of two vectors.
bool vec3i_is_zero(const vector3i v)
Returns true if every component is zero.
vector3i vec3i_sub_scalar(const vector3i v, const vm_int_t s)
Subtracts a scalar from each component.
vector3i vec3i_max(const vector3i a, const vector3i b)
Computes the component-wise maximum of two vector3i.
vector3i vec3i_y_scale(const vm_int_t y)
Returns a vector3i for scaling along the y-axis.
vm_int_t vec3i_length_squared(const vector3i v)
Returns the squared Euclidean length.
vm_int_t vec3i_dot(const vector3i a, const vector3i b)
Computes the dot product of two vector3i.
vector3i vec3i_div_scalar(const vector3i v, const vm_int_t s)
Component-wise division of vector by scalar.
vm_float_t vec3i_angle(const vector3i a, const vector3i b)
Computes the angle between two non-zero vector3i in radians.
vector3i vec3i_div_floor(const vector3i a, const vector3i b)
Component-wise floored division of a by b.
vector3i vec3i_neg(const vector3i v)
Negation of a vector.
vector3i vec3i_clamp(const vector3i v, const vector3i min, const vector3i max)
Clamps a vector3i between min and max per component.
vector3i vec3i_min(const vector3i a, const vector3i b)
Computes the component-wise minimum of two vector3i.
vm_int_t vec3i_length_manhattan(const vector3i v)
Returns the Manhattan (L1) length.
vm_int_t vec3i_min_component(const vector3i v)
Returns the smallest component.
vector3i vec3i_x_scale(const vm_int_t x)
Returns a vector3i for scaling along the x-axis.
vector3i vec3i_zero(void)
Returns a zero-initialized vector3i.
vector3i vec3i_z_axis(const vm_int_t z)
Returns a vector3i along the z-axis.
vector3i vec3i_div(const vector3i a, const vector3i b)
Divides two vectors component-wise.
vm_int_t vec3i_max_component(const vector3i v)
Returns the largest component.
vm_int_t vec3i_distance_squared(const vector3i a, const vector3i b)
Returns the squared Euclidean distance between a and b.
vector3i vec3i_wrap(const vector3i v, const vector3i period)
Wraps each component of v into [0, period).
vector3i vec3i_add_scalar(const vector3i v, const vm_int_t s)
Adds a scalar to each component.
vector3i vec3i_mul_scalar(const vector3i v, const vm_int_t s)
Component-wise multiplication of vector by scalar.
vector3i vec3i_x_axis(const vm_int_t x)
Returns a vector3i along the x-axis.
vector3i vec3i_z_scale(const vm_int_t z)
Returns a vector3i for scaling along the z-axis.
vector3i vec3i_abs(const vector3i v)
Computes the absolute value per component of a vector3i.
vector3i vec3i_from_vec2i(const vector2i v, const vm_int_t z)
Builds a vector3i from a vector2i and z.
vector3i vec3i_mod(const vector3i a, const vector3i b)
Component-wise floor modulo of a by b.
vector3i vec3i_sign(const vector3i v)
Computes the sign per component of a vector3i (-1, 0, or 1).
vm_int_t vec3i_sum(const vector3i v)
Returns the sum of all components.
vector3i vec3i_mul(const vector3i a, const vector3i b)
Component-wise multiplication of two vectors.
vm_float_t vec3i_distance(const vector3i a, const vector3i b)
Computes the Euclidean distance between two vector3i.
vm_int_t vec3i_length_chebyshev(const vector3i v)
Returns the Chebyshev (L-inf) length.
vector3i vec3i_splat(const vm_int_t s)
Returns a vector with every component set to s.
vector3i vec3i_add(const vector3i a, const vector3i b)
Component-wise addition of two vectors.
vector2i vec3i_xy(const vector3i v)
Returns the x and y components as a 2D vector.
vm_float_t vec3i_length(const vector3i v)
Computes the length (magnitude) of a vector3i.