142 res->
x = a->
y * b->
z - a->
z * b->
y;
143 res->
y = a->
z * b->
x - a->
x * b->
z;
144 res->
z = a->
x * b->
y - a->
y * b->
x;
156 res->
x = a->
x < b->
x ? a->
x : b->
x;
157 res->
y = a->
y < b->
y ? a->
y : b->
y;
158 res->
z = a->
z < b->
z ? a->
z : b->
z;
170 res->
x = a->
x > b->
x ? a->
x : b->
x;
171 res->
y = a->
y > b->
y ? a->
y : b->
y;
172 res->
z = a->
z > b->
z ? a->
z : b->
z;
183 res->
x = v->
x > 0 ? 1 : v->
x < 0 ? -1 : 0;
184 res->
y = v->
y > 0 ? 1 : v->
y < 0 ? -1 : 0;
185 res->
z = v->
z > 0 ? 1 : v->
z < 0 ? -1 : 0;
214 res->
x = v->
x < min->
x ? min->
x : (v->
x > max->
x ? max->
x : v->
x);
215 res->
y = v->
y < min->
y ? min->
y : (v->
y > max->
y ? max->
y : v->
y);
216 res->
z = v->
z < min->
z ? min->
z : (v->
z > max->
z ? max->
z : v->
z);
227 if (r != 0 && ((a < 0) != (b < 0))) {
240 if (r != 0 && ((a < 0) != (b < 0))) {
255 res->
x = (b->
x == 0) ? 0 : a->
x / b->
x;
256 res->
y = (b->
y == 0) ? 0 : a->
y / b->
y;
257 res->
z = (b->
z == 0) ? 0 : a->
z / b->
z;
void vec3_normalize_ptr(vector3 *res, const vector3 *v)
Normalize a vector to unit length.
vm_float_t vec3i_length(vector3i v)
Computes the length (magnitude) of a vector3i.
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_from_vec2i_ptr(vector3i *res, const vector2i *v, const vm_int_t z)
Builds a vector3i from a vector2i and z.
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_add_scalar_ptr(vector3i *res, const vector3i *v, const vm_int_t s)
Adds a scalar to each component.
void vec3i_sub_scalar_ptr(vector3i *res, const vector3i *v, const vm_int_t s)
Subtracts a scalar from each component.
void vec3i_lerp_ptr(vector3i *res, const vector3i *a, const vector3i *b, const vm_float_t t)
Performs linear interpolation between two vector3i.
static vm_int_t vm_div_floor3(const vm_int_t a, const vm_int_t b)
void vec3i_abs_ptr(vector3i *res, const vector3i *v)
Computes the absolute value of each component of a vector3i.
void vec3i_mul_scalar_ptr(vector3i *res, const vector3i *v, const vm_int_t s)
Scales a vector3i by an integer scalar.
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_div_ptr(vector3i *res, const vector3i *a, const vector3i *b)
Divides two vectors component-wise.
static vm_int_t vm_mod_floor3(const vm_int_t a, const vm_int_t b)
void vec3i_div_scalar_ptr(vector3i *res, const vector3i *v, const vm_int_t s)
Scales a vector3i by the inverse of an integer scalar.
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_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.