include/vecmat/vec.h file

Vector algebra (value and _ptr), conversions, constructors.

Functions

auto vec2_add(vector2 a, vector2 b) -> vector2
Adds two vectors component-wise.
auto vec2_sub(vector2 a, vector2 b) -> vector2
Subtracts the second vector from the first component-wise.
auto vec2_mul_scalar(vector2 v, vm_float_t s) -> vector2
Multiplies a vector by a scalar component-wise.
auto vec2_div_scalar(vector2 v, vm_float_t s) -> vector2
Divides a vector by a scalar component-wise.
auto vec2_mul(vector2 a, vector2 b) -> vector2
Multiplies two vectors component-wise (Hadamard product).
auto vec2_neg(vector2 v) -> vector2
Negates the vector (multiplies each component by -1.0f).
auto vec2_abs(vector2 v) -> vector2
Returns the absolute values of each component.
auto vec2_zero(void) -> vector2
Returns a vector2 with both components set to 0.0f.
auto vec2_one(void) -> vector2
Returns a vector2 with both components set to 1.0f.
auto vec2_x_axis(vm_float_t x) -> vector2
Returns a vector2 along the x-axis (y = 0.0f).
auto vec2_y_axis(vm_float_t y) -> vector2
Returns a vector2 along the y-axis (x = 0.0f).
auto vec2_x_scale(vm_float_t x) -> vector2
Returns a vector2 representing x-axis scaling (y = 1.0f).
auto vec2_y_scale(vm_float_t y) -> vector2
Returns a vector2 representing y-axis scaling (x = 1.0f).
auto vec2_scale(vector2 v, vm_float_t s) -> vector2
Scales a vector by a scalar component-wise.
auto vec2_cross(vector2 a, vector2 b) -> vector2
Computes the 2D cross-product as a vector.
auto vec2_normalize(vector2 v) -> vector2
Normalizes the vector to unit length.
auto vec2_min(vector2 a, vector2 b) -> vector2
Returns the component-wise minimum of two vectors.
auto vec2_max(vector2 a, vector2 b) -> vector2
Returns the component-wise maximum of two vectors.
auto vec2_sign(vector2 v) -> vector2
Returns the sign of each component (+1.0f, -1.0f, or 0.0f).
auto vec2_floor(vector2 v) -> vector2
Applies floor to each component.
auto vec2_ceil(vector2 v) -> vector2
Applies ceil to each component.
auto vec2_round(vector2 v) -> vector2
Applies round to each component.
auto vec2_perpendicular(vector2 v) -> vector2
Returns the perpendicular vector (90 degrees counterclockwise).
auto vec2_reflect(vector2 v, vector2 normal) -> vector2
Reflects vector v across the normal, storing the result in res.
auto vec2_project(vector2 a, vector2 b) -> vector2
Projects the first vector onto the second.
auto vec2_tangent(vector2 v) -> vector2
Returns the tangent vector perpendicular to the input (90 degrees clockwise).
auto vec2_rotate(vector2 v, vm_float_t radians) -> vector2
Rotates the input vector counterclockwise by the given angle (radians).
auto vec2_rotate_deg(vector2 v, vm_float_t degrees) -> vector2
Rotates a vector2 by the given angle in degrees.
auto vec2_slide(vector2 v, vector2 normal) -> vector2
Slides the input vector tangent to the normal (removes normal component).
auto vec2_clamp(vector2 v, vector2 min, vector2 max) -> vector2
Clamps vector v component-wise between min and max.
auto vec2_lerp(vector2 a, vector2 b, vm_float_t t) -> vector2
Linearly interpolates from a to b by t.
auto vec2_div(vector2 a, vector2 b) -> vector2
Divides two vectors component-wise.
auto vec2_add_scalar(vector2 v, vm_float_t s) -> vector2
Adds a scalar to each component.
auto vec2_sub_scalar(vector2 v, vm_float_t s) -> vector2
Subtracts a scalar from each component.
auto vec2_clamp_scalar(vector2 v, vm_float_t min, vm_float_t max) -> vector2
Clamps each component to the scalar range [min, max].
auto vec2_saturate(vector2 v) -> vector2
Clamps each component to the range [0, 1].
auto vec2_fract(vector2 v) -> vector2
Returns the fractional part of each component.
auto vec2_refract(vector2 incident, vector2 normal, vm_float_t eta) -> vector2
Computes the refraction of incident across normal with ratio eta.
auto vec2_reject(vector2 a, vector2 b) -> vector2
Returns the component of a orthogonal to b.
auto vec2_splat(vm_float_t s) -> vector2
Returns a vector with every component set to s.
auto vec2_from_angle(vm_float_t radians) -> vector2
Returns the unit vector at the given angle in radians.
auto vec2_from_angle_deg(vm_float_t degrees) -> vector2
Creates a vector2 from an angle given in degrees.
auto vec2_rotate_around(vector2 v, vector2 pivot, vm_float_t radians) -> vector2
Rotates v around pivot by angle radians.
auto vec2_rotate_around_deg(vector2 v, vector2 pivot, vm_float_t degrees) -> vector2
Rotates a vector2 around a pivot point by the given angle in degrees.
auto vec2_move_toward(vector2 current, vector2 target, vm_float_t max_delta) -> vector2
Moves current toward target by at most max_delta.
auto vec2_limit_length(vector2 v, vm_float_t max_len) -> vector2
Clamps the vector length to max_len.
auto vec2_to_vec3(vector2 v, vm_float_t z) -> vector3
Converts a vector2 to a vector3 using z.
auto vec2_dot(vector2 a, vector2 b) -> vm_float_t
Computes the dot product of two vectors.
auto vec2_length(vector2 v) -> vm_float_t
Computes the length (magnitude) of the vector.
auto vec2_length_squared(vector2 v) -> vm_float_t
Returns the squared Euclidean length.
auto vec2_length_manhattan(vector2 v) -> vm_float_t
Returns the Manhattan (L1) length.
auto vec2_length_chebyshev(vector2 v) -> vm_float_t
Returns the Chebyshev (L-inf) length.
auto vec2_aspect_ratio(vector2 v) -> vm_float_t
Computes the aspect ratio of the vector (x / y).
auto vec2_distance(vector2 a, vector2 b) -> vm_float_t
Computes the Euclidean distance between two vectors (treated as points).
auto vec2_distance_squared(vector2 a, vector2 b) -> vm_float_t
Returns the squared Euclidean distance between a and b.
auto vec2_angle(vector2 a, vector2 b) -> vm_float_t
Computes the angle between two vectors (in radians, range [0, PI]).
auto vec2_cross_scalar(vector2 a, vector2 b) -> vm_float_t
Returns the 2D cross product as a scalar (a.x*b.y - a.y*b.x).
auto vec2_heading(vector2 v) -> vm_float_t
Returns the heading angle of the vector in radians.
auto vec2_heading_deg(vector2 v) -> vm_float_t
Returns the heading angle of the vector in degrees.
auto vec2_min_component(vector2 v) -> vm_float_t
Returns the smallest component.
auto vec2_max_component(vector2 v) -> vm_float_t
Returns the largest component.
auto vec2_sum(vector2 v) -> vm_float_t
Returns the sum of all components.
auto vec2_is_zero(vector2 v) -> bool
Returns true if every component is zero.
auto vec2_is_normalized(vector2 v) -> bool
Returns true if the vector has unit length.
auto vec2_near(vector2 a, vector2 b, vm_float_t eps) -> bool
Returns true if a and b are within eps of each other.
auto vec3_add(vector3 a, vector3 b) -> vector3
Component-wise addition of two vectors.
auto vec3_sub(vector3 a, vector3 b) -> vector3
Component-wise subtraction of two vectors.
auto vec3_mul_scalar(vector3 v, vm_float_t s) -> vector3
Component-wise multiplication of vector by scalar.
auto vec3_div_scalar(vector3 v, vm_float_t s) -> vector3
Component-wise division of vector by scalar.
auto vec3_mul(vector3 a, vector3 b) -> vector3
Component-wise multiplication of two vectors.
auto vec3_neg(vector3 v) -> vector3
Negation of a vector.
auto vec3_abs(vector3 v) -> vector3
Computes the absolute value per component of a vector3.
auto vec3_zero(void) -> vector3
Returns a zero-initialized vector3.
auto vec3_one(void) -> vector3
Returns a vector3 with all components set to 1.0f.
auto vec3_x_axis(vm_float_t x) -> vector3
Returns a vector3 along the x-axis.
auto vec3_y_axis(vm_float_t y) -> vector3
Returns a vector3 along the y-axis.
auto vec3_z_axis(vm_float_t z) -> vector3
Returns a vector3 along the z-axis.
auto vec3_x_scale(vm_float_t x) -> vector3
Returns a vector3 for scaling along the x-axis.
auto vec3_y_scale(vm_float_t y) -> vector3
Returns a vector3 for scaling along the y-axis.
auto vec3_z_scale(vm_float_t z) -> vector3
Returns a vector3 for scaling along the z-axis.
auto vec3_cross(vector3 a, vector3 b) -> vector3
Computes the cross-product of two vector3.
auto vec3_normalize(vector3 v) -> vector3
Normalizes a vector3 to unit length.
auto vec3_min(vector3 a, vector3 b) -> vector3
Computes the component-wise minimum of two vector3.
auto vec3_max(vector3 a, vector3 b) -> vector3
Computes the component-wise maximum of two vector3.
auto vec3_sign(vector3 v) -> vector3
Computes the sign per component of a vector3 (-1, 0, or 1).
auto vec3_floor(vector3 v) -> vector3
Applies the floor per component to a vector3.
auto vec3_ceil(vector3 v) -> vector3
Applies ceil per component to a vector3.
auto vec3_round(vector3 v) -> vector3
Applies round per component to a vector3.
auto vec3_reflect(vector3 incident, vector3 normal) -> vector3
Reflects an incident vector over normal.
auto vec3_refract(vector3 incident, vector3 normal, vm_float_t eta) -> vector3
Refracts an incident vector across an interface with a given normal and ratio of refraction eta.
auto vec3_lerp(vector3 a, vector3 b, vm_float_t t) -> vector3
Linearly interpolates between two vector3.
auto vec3_clamp(vector3 v, vector3 min, vector3 max) -> vector3
Clamps a vector3 between min and max per component.
auto vec3_scale(vector3 v, vm_float_t s) -> vector3
Scales the vector by a scalar.
auto vec3_div(vector3 a, vector3 b) -> vector3
Divides two vectors component-wise.
auto vec3_add_scalar(vector3 v, vm_float_t s) -> vector3
Adds a scalar to each component.
auto vec3_sub_scalar(vector3 v, vm_float_t s) -> vector3
Subtracts a scalar from each component.
auto vec3_clamp_scalar(vector3 v, vm_float_t min, vm_float_t max) -> vector3
Clamps each component to the scalar range [min, max].
auto vec3_saturate(vector3 v) -> vector3
Clamps each component to the range [0, 1].
auto vec3_fract(vector3 v) -> vector3
Returns the fractional part of each component.
auto vec3_project(vector3 a, vector3 b) -> vector3
Projects a onto b.
auto vec3_slide(vector3 v, vector3 normal) -> vector3
Removes the component of v along normal.
auto vec3_reject(vector3 a, vector3 b) -> vector3
Returns the component of a orthogonal to b.
auto vec3_rotate_axis(vector3 v, vector3 axis, vm_float_t radians) -> vector3
Rotates v around axis by angle radians.
auto vec3_rotate_axis_deg(vector3 v, vector3 axis, vm_float_t degrees) -> vector3
Rotates a vector around an arbitrary axis by a given angle in degrees.
auto vec3_splat(vm_float_t s) -> vector3
Returns a vector with every component set to s.
auto vec3_from_vec2(vector2 v, vm_float_t z) -> vector3
Builds a vector3 from a vector2 and z.
auto vec3_move_toward(vector3 current, vector3 target, vm_float_t max_delta) -> vector3
Moves current toward target by at most max_delta.
auto vec3_limit_length(vector3 v, vm_float_t max_len) -> vector3
Clamps the vector length to max_len.
auto vec3_xy(vector3 v) -> vector2
Returns the x and y components as a 2D vector.
void vec3_orthonormal_basis(vector3 n, vector3* t, vector3* b)
Builds a tangent and bitangent orthonormal to n.
auto vec3_dot(vector3 a, vector3 b) -> vm_float_t
Computes the dot product of two vector3.
auto vec3_length(vector3 v) -> vm_float_t
Computes the length (magnitude) of a vector3.
auto vec3_length_squared(vector3 v) -> vm_float_t
Returns the squared Euclidean length.
auto vec3_length_manhattan(vector3 v) -> vm_float_t
Returns the Manhattan (L1) length.
auto vec3_length_chebyshev(vector3 v) -> vm_float_t
Returns the Chebyshev (L-inf) length.
auto vec3_distance(vector3 a, vector3 b) -> vm_float_t
Computes the Euclidean distance between two vector3.
auto vec3_distance_squared(vector3 a, vector3 b) -> vm_float_t
Returns the squared Euclidean distance between a and b.
auto vec3_angle(vector3 a, vector3 b) -> vm_float_t
Computes the angle between two non-zero vector3 in radians.
auto vec3_signed_angle(vector3 a, vector3 b, vector3 axis) -> vm_float_t
Returns the signed angle from a to b around axis.
auto vec3_min_component(vector3 v) -> vm_float_t
Returns the smallest component.
auto vec3_max_component(vector3 v) -> vm_float_t
Returns the largest component.
auto vec3_sum(vector3 v) -> vm_float_t
Returns the sum of all components.
auto vec3_is_zero(vector3 v) -> bool
Returns true if every component is zero.
auto vec3_is_normalized(vector3 v) -> bool
Returns true if the vector has unit length.
auto vec3_near(vector3 a, vector3 b, vm_float_t eps) -> bool
Returns true if a and b are within eps of each other.
auto vec4_add(vector4 a, vector4 b) -> vector4
Component-wise addition of two vectors.
auto vec4_sub(vector4 a, vector4 b) -> vector4
Component-wise subtraction of two vectors.
auto vec4_mul_scalar(vector4 v, vm_float_t s) -> vector4
Component-wise multiplication of vector by scalar.
auto vec4_div_scalar(vector4 v, vm_float_t s) -> vector4
Component-wise division of vector by scalar.
auto vec4_mul(vector4 a, vector4 b) -> vector4
Component-wise multiplication of two vectors.
auto vec4_neg(vector4 v) -> vector4
Negation of a vector.
auto vec4_abs(vector4 v) -> vector4
Computes the absolute value per component of a vector4.
auto vec4_zero(void) -> vector4
Returns a zero-initialized vector4.
auto vec4_one(void) -> vector4
Returns a vector4 with all components set to 1.0f.
auto vec4_x_axis(vm_float_t x) -> vector4
Returns a vector4 along the x-axis.
auto vec4_y_axis(vm_float_t y) -> vector4
Returns a vector4 along the y-axis.
auto vec4_z_axis(vm_float_t z) -> vector4
Returns a vector4 along the z-axis.
auto vec4_w_axis(vm_float_t w) -> vector4
Returns a vector4 along the w-axis.
auto vec4_x_scale(vm_float_t x) -> vector4
Returns avector4 for scaling along the x-axis.
auto vec4_y_scale(vm_float_t y) -> vector4
Returns a vector4 for scaling along the y-axis.
auto vec4_z_scale(vm_float_t z) -> vector4
Returns a vector4for scaling along the z-axis.
auto vec4_w_scale(vm_float_t w) -> vector4
Returns a vector4 for scaling along the w-axis.
auto vec4_normalize(vector4 v) -> vector4
Normalizes a vector4 to unit length.
auto vec4_min(vector4 a, vector4 b) -> vector4
Computes the component-wise minimum of two vector4.
auto vec4_max(vector4 a, vector4 b) -> vector4
Computes the component-wise maximum of two vector4.
auto vec4_sign(vector4 v) -> vector4
Computes the sign per component of a vector4 (-1, 0, or 1).
auto vec4_floor(vector4 v) -> vector4
Applies the floor per component to a vector4.
auto vec4_ceil(vector4 v) -> vector4
Applies ceil per component to a vector4.
auto vec4_round(vector4 v) -> vector4
Applies round per component to a vector4.
auto vec4_lerp(vector4 a, vector4 b, vm_float_t t) -> vector4
Linearly interpolates between two vector4.
auto vec4_clamp(vector4 v, vector4 min, vector4 max) -> vector4
Clamps a vector4 between min and max per component.
auto vec4_homogenize(vector4 v) -> vector4
Homogenizes a vector4 (divides x, y, z by w).
auto vec4_div(vector4 a, vector4 b) -> vector4
Divides two vectors component-wise.
auto vec4_add_scalar(vector4 v, vm_float_t s) -> vector4
Adds a scalar to each component.
auto vec4_sub_scalar(vector4 v, vm_float_t s) -> vector4
Subtracts a scalar from each component.
auto vec4_clamp_scalar(vector4 v, vm_float_t min, vm_float_t max) -> vector4
Clamps each component to the scalar range [min, max].
auto vec4_saturate(vector4 v) -> vector4
Clamps each component to the range [0, 1].
auto vec4_fract(vector4 v) -> vector4
Returns the fractional part of each component.
auto vec4_project(vector4 a, vector4 b) -> vector4
Projects a onto b.
auto vec4_reject(vector4 a, vector4 b) -> vector4
Returns the component of a orthogonal to b.
auto vec4_slide(vector4 v, vector4 normal) -> vector4
Removes the component of v along normal.
auto vec4_splat(vm_float_t s) -> vector4
Returns a vector with every component set to s.
auto vec4_to_vec3(vector4 v) -> vector3
Converts a vector4 to a vector3 (discards the w component).
auto vec4_dot(vector4 a, vector4 b) -> vm_float_t
Computes the dot product of two vector4.
auto vec4_length(vector4 v) -> vm_float_t
Computes the length (magnitude) of a vector4.
auto vec4_length_squared(vector4 v) -> vm_float_t
Returns the squared Euclidean length.
auto vec4_distance(vector4 a, vector4 b) -> vm_float_t
Computes the Euclidean distance between two vector4.
auto vec4_distance_squared(vector4 a, vector4 b) -> vm_float_t
Returns the squared Euclidean distance between a and b.
auto vec4_is_zero(vector4 v) -> bool
Returns true if every component is zero.
auto vec4_is_normalized(vector4 v) -> bool
Returns true if the vector has unit length.
auto vec4_near(vector4 a, vector4 b, vm_float_t eps) -> bool
Returns true if a and b are within eps of each other.
void vec2_add_ptr(vector2* res, const vector2* a, const vector2* b)
Adds vectors a and b component-wise, storing the result in res.
void vec2_sub_ptr(vector2* res, const vector2* a, const vector2* b)
Subtracts vector b from vector a component-wise, storing the result in res.
void vec2_mul_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)
Multiplies vector v by scalar s component-wise, storing the result in res.
void vec2_div_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)
Divides vector v by scalar s component-wise, storing the result in res.
void vec2_mul_ptr(vector2* res, const vector2* a, const vector2* b)
Multiplies vectors a and b component-wise, storing the result in res.
void vec2_neg_ptr(vector2* res, const vector2* v)
Negates the components of vector v, storing the result in res.
void vec2_abs_ptr(vector2* res, const vector2* v)
Computes the absolute values of the components of vector v, storing the result in res.
void vec2_normalize_ptr(vector2* res, const vector2* v)
Normalizes vector v to unit length, storing the result in res.
void vec2_min_ptr(vector2* res, const vector2* a, const vector2* b)
Computes the component-wise minimum of vectors a and b, storing the result in res.
void vec2_max_ptr(vector2* res, const vector2* a, const vector2* b)
Computes the component-wise maximum of vectors a and b, storing the result in res.
void vec2_sign_ptr(vector2* res, const vector2* v)
Sets each component of res to the sign of the corresponding component in v (+1, -1).
void vec2_floor_ptr(vector2* res, const vector2* v)
Applies the floor function to each component of vector v, storing the result in res.
void vec2_ceil_ptr(vector2* res, const vector2* v)
Applies the ceil function to each component of vector v, storing the result in res.
void vec2_round_ptr(vector2* res, const vector2* v)
Applies the round function to each component of vector v, storing the result in res.
void vec2_perpendicular_ptr(vector2* res, const vector2* v)
Computes the perpendicular vector to v (90 degrees counterclockwise rotation), storing the result in res.
void vec2_scale_ptr(vector2* res, const vector2* v, vm_float_t s)
Scales a vector by a scalar component-wise, storing the result in res.
void vec2_cross_ptr(vector2* res, const vector2* a, const vector2* b)
Computes the 2D cross-product of a and b, storing the scalar value in res->x and 0 in res->y.
void vec2_reflect_ptr(vector2* res, const vector2* v, const vector2* normal)
Reflects vector v across the normal, storing the result in res.
void vec2_project_ptr(vector2* res, const vector2* a, const vector2* b)
Projects vector a onto vector b (scalar projection scaled by b).
void vec2_tangent_ptr(vector2* res, const vector2* v)
Computes a tangent vector perpendicular to the input (90 degrees clockwise).
void vec2_rotate_ptr(vector2* result, const vector2* v, vm_float_t radians)
Rotates the input vector counterclockwise by the given angle (radians).
void vec2_rotate_deg_ptr(vector2* result, const vector2* v, vm_float_t degrees)
Rotates vector v by the given angle in degrees, storing the result in result.
void vec2_slide_ptr(vector2* result, const vector2* v, const vector2* normal)
Slides the input vector tangent to the normal (removes normal component).
void vec2_clamp_ptr(vector2* res, const vector2* v, const vector2* min, const vector2* max)
Clamps vector v component-wise between min and max.
void vec2_lerp_ptr(vector2* res, const vector2* a, const vector2* b, vm_float_t t)
Linearly interpolates from a to b by t.
void vec2_div_ptr(vector2* res, const vector2* a, const vector2* b)
Divides two vectors component-wise.
void vec2_add_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)
Adds a scalar to each component.
void vec2_sub_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)
Subtracts a scalar from each component.
void vec2_clamp_scalar_ptr(vector2* res, const vector2* v, vm_float_t min, vm_float_t max)
Clamps each component to the scalar range [min, max].
void vec2_saturate_ptr(vector2* res, const vector2* v)
Clamps each component to the range [0, 1].
void vec2_fract_ptr(vector2* res, const vector2* v)
Returns the fractional part of each component.
void vec2_refract_ptr(vector2* res, const vector2* incident, const vector2* normal, vm_float_t eta)
Computes the refraction of incident across normal with ratio eta.
void vec2_reject_ptr(vector2* res, const vector2* a, const vector2* b)
Returns the component of a orthogonal to b.
void vec2_rotate_around_ptr(vector2* res, const vector2* v, const vector2* pivot, vm_float_t radians)
Rotates v around pivot by angle radians.
void vec2_rotate_around_deg_ptr(vector2* res, const vector2* v, const vector2* pivot, vm_float_t degrees)
Rotates vector v around the given pivot point by the specified angle in degrees.
void vec2_move_toward_ptr(vector2* res, const vector2* current, const vector2* target, vm_float_t max_delta)
Moves current toward target by at most max_delta.
void vec2_limit_length_ptr(vector2* res, const vector2* v, vm_float_t max_len)
Clamps the vector length to max_len.
void vec2_to_vec3_ptr(vector3* res, const vector2* v, vm_float_t z)
Converts a vector2 to a vector3 with the given z.
void vec3_add_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise addition of two vectors.
void vec3_sub_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise subtraction of two vectors.
void vec3_mul_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)
Component-wise multiplication of vector by scalar.
void vec3_div_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)
Component-wise division of vector by scalar.
void vec3_mul_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise multiplication of two vectors.
void vec3_neg_ptr(vector3* res, const vector3* v)
Negation of a vector.
void vec3_abs_ptr(vector3* res, const vector3* v)
Computes the absolute value per component of a vector3.
void vec3_normalize_ptr(vector3* res, const vector3* v)
Normalize a vector to unit length.
void vec3_cross_ptr(vector3* res, const vector3* a, const vector3* b)
Compute cross-product of two vectors.
void vec3_min_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise minimum of two vectors.
void vec3_max_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise maximum of two vectors.
void vec3_sign_ptr(vector3* res, const vector3* v)
Component-wise sign of a vector.
void vec3_floor_ptr(vector3* res, const vector3* v)
Component-wise floor of a vector.
void vec3_ceil_ptr(vector3* res, const vector3* v)
Component-wise ceil of a vector.
void vec3_round_ptr(vector3* res, const vector3* v)
Component-wise round of a vector.
void vec3_reflect_ptr(vector3* res, const vector3* incident, const vector3* normal)
Compute reflection of the incident vector over normal.
void vec3_refract_ptr(vector3* res, const vector3* incident, const vector3* normal, vm_float_t eta)
Compute refraction of the incident vector through normal with eta.
void vec3_lerp_ptr(vector3* res, const vector3* a, const vector3* b, vm_float_t t)
Linear interpolation between two vectors.
void vec3_clamp_ptr(vector3* res, const vector3* v, const vector3* min, const vector3* max)
Clamp vector components between min and max.
void vec3_scale_ptr(vector3* res, const vector3* v, vm_float_t s)
Scales the vector by a scalar.
void vec3_div_ptr(vector3* res, const vector3* a, const vector3* b)
Divides two vectors component-wise.
void vec3_add_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)
Adds a scalar to each component.
void vec3_sub_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)
Subtracts a scalar from each component.
void vec3_clamp_scalar_ptr(vector3* res, const vector3* v, vm_float_t min, vm_float_t max)
Clamps each component to the scalar range [min, max].
void vec3_saturate_ptr(vector3* res, const vector3* v)
Clamps each component to the range [0, 1].
void vec3_fract_ptr(vector3* res, const vector3* v)
Returns the fractional part of each component.
void vec3_project_ptr(vector3* res, const vector3* a, const vector3* b)
Projects a onto b.
void vec3_slide_ptr(vector3* res, const vector3* v, const vector3* normal)
Removes the component of v along normal.
void vec3_reject_ptr(vector3* res, const vector3* a, const vector3* b)
Returns the component of a orthogonal to b.
void vec3_rotate_axis_ptr(vector3* res, const vector3* v, const vector3* axis, vm_float_t radians)
Rotates v around axis by angle radians.
void vec3_rotate_axis_deg_ptr(vector3* res, const vector3* v, const vector3* axis, vm_float_t degrees)
Component-wise rotation of a vector around an axis by a given angle in degrees.
void vec3_from_vec2_ptr(vector3* res, const vector2* v, vm_float_t z)
Builds a higher-dimension vector from a vector2.
void vec3_xy_ptr(vector2* res, const vector3* v)
Returns the x and y components as a 2D vector.
void vec3_move_toward_ptr(vector3* res, const vector3* current, const vector3* target, vm_float_t max_delta)
Moves current toward target by at most max_delta.
void vec3_limit_length_ptr(vector3* res, const vector3* v, vm_float_t max_len)
Clamps the vector length to max_len.
void vec3_orthonormal_basis_ptr(const vector3* n, vector3* t, vector3* b)
Builds a tangent and bitangent orthonormal to n.
void vec4_add_ptr(vector4* res, const vector4* a, const vector4* b)
Component-wise addition (dispatched).
void vec4_sub_ptr(vector4* res, const vector4* a, const vector4* b)
Component-wise subtraction (dispatched).
void vec4_mul_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)
Multiplies a vector by a scalar (dispatched).
void vec4_div_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)
Divides a vector by a scalar (dispatched).
void vec4_mul_ptr(vector4* res, const vector4* a, const vector4* b)
Component-wise multiplication (dispatched).
void vec4_neg_ptr(vector4* res, const vector4* v)
Negates a vector (dispatched).
void vec4_abs_ptr(vector4* res, const vector4* v)
Component-wise absolute value (dispatched).
void vec4_normalize_ptr(vector4* res, const vector4* v)
Normalizes a vector (dispatched).
void vec4_min_ptr(vector4* res, const vector4* a, const vector4* b)
Component-wise minimum (dispatched).
void vec4_max_ptr(vector4* res, const vector4* a, const vector4* b)
Component-wise maximum (dispatched).
void vec4_sign_ptr(vector4* res, const vector4* v)
Component-wise sign (dispatched).
void vec4_floor_ptr(vector4* res, const vector4* v)
Component-wise floor (dispatched).
void vec4_ceil_ptr(vector4* res, const vector4* v)
Component-wise ceil (dispatched).
void vec4_round_ptr(vector4* res, const vector4* v)
Component-wise round (dispatched).
void vec4_lerp_ptr(vector4* res, const vector4* a, const vector4* b, vm_float_t t)
Linear interpolation (dispatched).
void vec4_clamp_ptr(vector4* res, const vector4* v, const vector4* min, const vector4* max)
Component-wise clamp (dispatched).
void vec4_homogenize_ptr(vector4* res, const vector4* v)
Divides xyz by w (dispatched).
void vec4_div_ptr(vector4* res, const vector4* a, const vector4* b)
Component-wise division (dispatched).
void vec4_add_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)
Adds a scalar to each component (dispatched).
void vec4_sub_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)
Subtracts a scalar from each component (dispatched).
void vec4_clamp_scalar_ptr(vector4* res, const vector4* v, vm_float_t min, vm_float_t max)
Clamps each component to a scalar range (dispatched).
void vec4_saturate_ptr(vector4* res, const vector4* v)
Clamps each component to [0, 1] (dispatched).
void vec4_fract_ptr(vector4* res, const vector4* v)
Component-wise fractional part (dispatched).
void vec4_project_ptr(vector4* res, const vector4* a, const vector4* b)
Projects a onto b.
void vec4_reject_ptr(vector4* res, const vector4* a, const vector4* b)
Returns the component of a orthogonal to b.
void vec4_slide_ptr(vector4* res, const vector4* v, const vector4* normal)
Removes the component of v along normal.
void vec4_to_vec3_ptr(vector3* res, const vector4* v)
Copies the x, y, z components from a vector4 to a vector3.
auto vec2i_add(vector2i a, vector2i b) -> vector2i
Adds two vectors component-wise.
auto vec2i_sub(vector2i a, vector2i b) -> vector2i
Subtracts the second vector from the first component-wise.
auto vec2i_mul_scalar(vector2i v, vm_int_t s) -> vector2i
Multiplies a vector by a scalar component-wise.
auto vec2i_div_scalar(vector2i v, vm_int_t s) -> vector2i
Divides a vector by a scalar component-wise (float division, truncated to int).
auto vec2i_mul(vector2i a, vector2i b) -> vector2i
Multiplies two vectors component-wise (Hadamard product).
auto vec2i_neg(vector2i v) -> vector2i
Negates the vector (multiplies each component by -1).
auto vec2i_abs(vector2i v) -> vector2i
Returns the absolute values of each component.
auto vec2i_zero(void) -> vector2i
Returns a vector2i with both components set to 0.
auto vec2i_one(void) -> vector2i
Returns a vector2i with both components set to 1.
auto vec2i_x_axis(vm_int_t x) -> vector2i
Returns a vector2i along the x-axis (y = 0).
auto vec2i_y_axis(vm_int_t y) -> vector2i
Returns a vector2i along the y-axis (x = 0).
auto vec2i_x_scale(vm_int_t x) -> vector2i
Returns a vector2i representing x-axis scaling (y = 1).
auto vec2i_y_scale(vm_int_t y) -> vector2i
Returns a vector2i representing y-axis scaling (x = 1).
auto vec2i_cross(vector2i a, vector2i b) -> vector2i
Computes the 2D cross-product as a vector.
auto vec2i_normalize(vector2i v) -> vector2i
Normalizes the vector to approximate unit length (float length, truncated to int).
auto vec2i_min(vector2i a, vector2i b) -> vector2i
Returns the component-wise minimum of two vectors.
auto vec2i_max(vector2i a, vector2i b) -> vector2i
Returns the component-wise maximum of two vectors.
auto vec2i_sign(vector2i v) -> vector2i
Returns the sign of each component (+1, -1, or 0).
auto vec2i_perpendicular(vector2i v) -> vector2i
Returns the perpendicular vector (90 degrees counterclockwise).
auto vec2i_lerp(vector2i a, vector2i b, vm_float_t t) -> vector2i
Linearly interpolates from a to b by t.
auto vec2i_clamp(vector2i v, vector2i min, vector2i max) -> vector2i
Clamps each component between min and max.
auto vec2i_div(vector2i a, vector2i b) -> vector2i
Divides two vectors component-wise.
auto vec2i_add_scalar(vector2i v, vm_int_t s) -> vector2i
Adds a scalar to each component.
auto vec2i_sub_scalar(vector2i v, vm_int_t s) -> vector2i
Subtracts a scalar from each component.
auto vec2i_mod(vector2i a, vector2i b) -> vector2i
Component-wise floor modulo of a by b.
auto vec2i_div_floor(vector2i a, vector2i b) -> vector2i
Component-wise floored division of a by b.
auto vec2i_wrap(vector2i v, vector2i period) -> vector2i
Wraps each component of v into [0, period).
auto vec2i_splat(vm_int_t s) -> vector2i
Returns a vector with every component set to s.
auto vec2i_to_vec3i(vector2i v, vm_int_t z) -> vector3i
Converts a vector2i to a vector3i using z.
auto vec2i_normalize_to_vec2(vector2i v) -> vector2
Converts to a unit-length vector2.
auto vec2i_dot(vector2i a, vector2i b) -> vm_int_t
Computes the dot product of two vectors.
auto vec2i_cross_scalar(vector2i a, vector2i b) -> vm_int_t
Returns the 2D cross product as a scalar (a.x*b.y - a.y*b.x).
auto vec2i_length_squared(vector2i v) -> vm_int_t
Returns the squared Euclidean length.
auto vec2i_distance_squared(vector2i a, vector2i b) -> vm_int_t
Returns the squared Euclidean distance between a and b.
auto vec2i_length_manhattan(vector2i v) -> vm_int_t
Returns the Manhattan (L1) length.
auto vec2i_length_chebyshev(vector2i v) -> vm_int_t
Returns the Chebyshev (L-inf) length.
auto vec2i_min_component(vector2i v) -> vm_int_t
Returns the smallest component.
auto vec2i_max_component(vector2i v) -> vm_int_t
Returns the largest component.
auto vec2i_sum(vector2i v) -> vm_int_t
Returns the sum of all components.
auto vec2i_length(vector2i v) -> vm_float_t
Computes the length (magnitude) of the vector.
auto vec2i_distance(vector2i a, vector2i b) -> vm_float_t
Computes the Euclidean distance between two vectors (treated as points).
auto vec2i_angle(vector2i a, vector2i b) -> vm_float_t
Computes the signed angle between two vectors (in radians, range [-PI, PI]) using atan2(cross, dot).
auto vec2i_aspect_ratio(vector2i v) -> vm_float_t
Computes the aspect ratio of the vector (x / y).
auto vec2i_is_zero(vector2i v) -> bool
Returns true if every component is zero.
auto vec3i_add(vector3i a, vector3i b) -> vector3i
Component-wise addition of two vectors.
auto vec3i_sub(vector3i a, vector3i b) -> vector3i
Component-wise subtraction of two vectors.
auto vec3i_mul_scalar(vector3i v, vm_int_t s) -> vector3i
Component-wise multiplication of vector by scalar.
auto vec3i_div_scalar(vector3i v, vm_int_t s) -> vector3i
Component-wise division of vector by scalar.
auto vec3i_mul(vector3i a, vector3i b) -> vector3i
Component-wise multiplication of two vectors.
auto vec3i_neg(vector3i v) -> vector3i
Negation of a vector.
auto vec3i_abs(vector3i v) -> vector3i
Computes the absolute value per component of a vector3i.
auto vec3i_zero(void) -> vector3i
Returns a zero-initialized vector3i.
auto vec3i_one(void) -> vector3i
Returns a vector3i with all components set to 1.
auto vec3i_x_axis(vm_int_t x) -> vector3i
Returns a vector3i along the x-axis.
auto vec3i_y_axis(vm_int_t y) -> vector3i
Returns a vector3i along the y-axis.
auto vec3i_z_axis(vm_int_t z) -> vector3i
Returns a vector3i along the z-axis.
auto vec3i_x_scale(vm_int_t x) -> vector3i
Returns a vector3i for scaling along the x-axis.
auto vec3i_y_scale(vm_int_t y) -> vector3i
Returns a vector3i for scaling along the y-axis.
auto vec3i_z_scale(vm_int_t z) -> vector3i
Returns a vector3i for scaling along the z-axis.
auto vec3i_cross(vector3i a, vector3i b) -> vector3i
Computes the cross-product of two vector3i.
auto vec3i_normalize(vector3i v) -> vector3i
Normalizes a vector3i to unit length.
auto vec3i_min(vector3i a, vector3i b) -> vector3i
Computes the component-wise minimum of two vector3i.
auto vec3i_max(vector3i a, vector3i b) -> vector3i
Computes the component-wise maximum of two vector3i.
auto vec3i_sign(vector3i v) -> vector3i
Computes the sign per component of a vector3i (-1, 0, or 1).
auto vec3i_lerp(vector3i a, vector3i b, vm_float_t t) -> vector3i
Linearly interpolates between two vector3i.
auto vec3i_clamp(vector3i v, vector3i min, vector3i max) -> vector3i
Clamps a vector3i between min and max per component.
auto vec3i_div(vector3i a, vector3i b) -> vector3i
Divides two vectors component-wise.
auto vec3i_add_scalar(vector3i v, vm_int_t s) -> vector3i
Adds a scalar to each component.
auto vec3i_sub_scalar(vector3i v, vm_int_t s) -> vector3i
Subtracts a scalar from each component.
auto vec3i_mod(vector3i a, vector3i b) -> vector3i
Component-wise floor modulo of a by b.
auto vec3i_div_floor(vector3i a, vector3i b) -> vector3i
Component-wise floored division of a by b.
auto vec3i_wrap(vector3i v, vector3i period) -> vector3i
Wraps each component of v into [0, period).
auto vec3i_splat(vm_int_t s) -> vector3i
Returns a vector with every component set to s.
auto vec3i_from_vec2i(vector2i v, vm_int_t z) -> vector3i
Builds a vector3i from a vector2i and z.
auto vec3i_xy(vector3i v) -> vector2i
Returns the x and y components as a 2D vector.
auto vec3i_normalize_to_vec3(vector3i v) -> vector3
Converts to a unit-length vector3.
auto vec3i_dot(vector3i a, vector3i b) -> vm_int_t
Computes the dot product of two vector3i.
auto vec3i_length_squared(vector3i v) -> vm_int_t
Returns the squared Euclidean length.
auto vec3i_distance_squared(vector3i a, vector3i b) -> vm_int_t
Returns the squared Euclidean distance between a and b.
auto vec3i_length_manhattan(vector3i v) -> vm_int_t
Returns the Manhattan (L1) length.
auto vec3i_length_chebyshev(vector3i v) -> vm_int_t
Returns the Chebyshev (L-inf) length.
auto vec3i_min_component(vector3i v) -> vm_int_t
Returns the smallest component.
auto vec3i_max_component(vector3i v) -> vm_int_t
Returns the largest component.
auto vec3i_sum(vector3i v) -> vm_int_t
Returns the sum of all components.
auto vec3i_length(vector3i v) -> vm_float_t
Computes the length (magnitude) of a vector3i.
auto vec3i_distance(vector3i a, vector3i b) -> vm_float_t
Computes the Euclidean distance between two vector3i.
auto vec3i_angle(vector3i a, vector3i b) -> vm_float_t
Computes the angle between two non-zero vector3i in radians.
auto vec3i_is_zero(vector3i v) -> bool
Returns true if every component is zero.
auto vec4i_add(vector4i a, vector4i b) -> vector4i
Component-wise addition of two vectors.
auto vec4i_sub(vector4i a, vector4i b) -> vector4i
Component-wise subtraction of two vectors.
auto vec4i_mul_scalar(vector4i v, vm_int_t s) -> vector4i
Component-wise multiplication of vector by scalar.
auto vec4i_div_scalar(vector4i v, vm_int_t s) -> vector4i
Component-wise division of vector by scalar.
auto vec4i_mul(vector4i a, vector4i b) -> vector4i
Component-wise multiplication of two vectors.
auto vec4i_neg(vector4i v) -> vector4i
Negation of a vector.
auto vec4i_abs(vector4i v) -> vector4i
Computes the absolute value per component of a vector4i.
auto vec4i_zero(void) -> vector4i
Returns a zero-initialized vector4i.
auto vec4i_one(void) -> vector4i
Returns a vector4i with all components set to 1.
auto vec4i_x_axis(vm_int_t x) -> vector4i
Returns a vector4i along the x-axis.
auto vec4i_y_axis(vm_int_t y) -> vector4i
Returns a vector4i along the y-axis.
auto vec4i_z_axis(vm_int_t z) -> vector4i
Returns a vector4i along the z-axis.
auto vec4i_w_axis(vm_int_t w) -> vector4i
Returns a vector4i along the w-axis.
auto vec4i_x_scale(vm_int_t x) -> vector4i
Returns a vector4i for scaling along the x-axis.
auto vec4i_y_scale(vm_int_t y) -> vector4i
Returns a vector4i for scaling along the y-axis.
auto vec4i_z_scale(vm_int_t z) -> vector4i
Returns a vector4i for scaling along the z-axis.
auto vec4i_w_scale(vm_int_t w) -> vector4i
Returns a vector4i for scaling along the w-axis.
auto vec4i_normalize(vector4i v) -> vector4i
Normalizes a vector4i to unit length.
auto vec4i_min(vector4i a, vector4i b) -> vector4i
Computes the component-wise minimum of two vector4i.
auto vec4i_max(vector4i a, vector4i b) -> vector4i
Computes the component-wise maximum of two vector4i.
auto vec4i_sign(vector4i v) -> vector4i
Computes the sign per component of a vector4i (-1, 0, or 1).
auto vec4i_lerp(vector4i a, vector4i b, vm_float_t t) -> vector4i
Linearly interpolates between two vector4i.
auto vec4i_clamp(vector4i v, vector4i min, vector4i max) -> vector4i
Clamps each component of the input vector to the range defined by the minimum and maximum vectors.
auto vec4i_div(vector4i a, vector4i b) -> vector4i
Divides two vectors component-wise.
auto vec4i_add_scalar(vector4i v, vm_int_t s) -> vector4i
Adds a scalar to each component.
auto vec4i_sub_scalar(vector4i v, vm_int_t s) -> vector4i
Subtracts a scalar from each component.
auto vec4i_mod(vector4i a, vector4i b) -> vector4i
Component-wise floor modulo of a by b.
auto vec4i_div_floor(vector4i a, vector4i b) -> vector4i
Component-wise floored division of a by b.
auto vec4i_wrap(vector4i v, vector4i period) -> vector4i
Wraps each component of v into [0, period).
auto vec4i_splat(vm_int_t s) -> vector4i
Returns a vector with every component set to s.
auto vec4i_to_vec3i(vector4i v) -> vector3i
Converts a vector4i to a vector3i (discards the w component).
auto vec4i_dot(vector4i a, vector4i b) -> vm_int_t
Computes the dot product of two vector4i.
auto vec4i_length_squared(vector4i v) -> vm_int_t
Returns the squared Euclidean length.
auto vec4i_distance_squared(vector4i a, vector4i b) -> vm_int_t
Returns the squared Euclidean distance between a and b.
auto vec4i_length_manhattan(vector4i v) -> vm_int_t
Returns the Manhattan (L1) length.
auto vec4i_length_chebyshev(vector4i v) -> vm_int_t
Returns the Chebyshev (L-inf) length.
auto vec4i_min_component(vector4i v) -> vm_int_t
Returns the smallest component.
auto vec4i_max_component(vector4i v) -> vm_int_t
Returns the largest component.
auto vec4i_sum(vector4i v) -> vm_int_t
Returns the sum of all components.
auto vec4i_length(vector4i v) -> vm_float_t
Computes the length (magnitude) of a vector4i.
auto vec4i_distance(vector4i a, vector4i b) -> vm_float_t
Computes the Euclidean distance between two vector4i.
auto vec4i_is_zero(vector4i v) -> bool
Returns true if every component is zero.
void vec2i_add_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Adds vectors a and b component-wise, storing the result in res.
void vec2i_sub_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Subtracts vector b from vector a component-wise, storing the result in res.
void vec2i_mul_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)
Multiplies vector v by scalar s component-wise, storing the result in res.
void vec2i_div_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)
Divides vector v by scalar s component-wise (float division, truncated to int), storing the result in res.
void vec2i_mul_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Multiplies vectors a and b component-wise (Hadamard product), storing the result in res.
void vec2i_neg_ptr(vector2i* res, const vector2i* v)
Negates the components of vector v, storing the result in res.
void vec2i_abs_ptr(vector2i* res, const vector2i* v)
Computes the absolute values of the components of vector v (using int abs), storing the result in res.
void vec2i_normalize_ptr(vector2i* res, const vector2i* v)
Normalizes vector v to approximate unit length (float length computation, truncated to int), storing the result in res.
void vec2i_min_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Computes the component-wise minimum of vectors a and b, storing the result in res.
void vec2i_max_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Computes the component-wise maximum of vectors a and b, storing the result in res.
void vec2i_sign_ptr(vector2i* res, const vector2i* v)
Sets each component of res to the sign of the corresponding component in v (+1, -1, or 0).
void vec2i_perpendicular_ptr(vector2i* res, const vector2i* v)
Computes the perpendicular vector to v (90 degrees counterclockwise rotation), storing the result in res.
void vec2i_cross_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Computes the 2D cross-product of a and b, storing the scalar value in res->x and 0 in res->y.
void vec2i_lerp_ptr(vector2i* res, const vector2i* a, const vector2i* b, vm_float_t t)
Linearly interpolates from a to b by t.
void vec2i_clamp_ptr(vector2i* res, const vector2i* v, const vector2i* min, const vector2i* max)
Clamps each component between min and max.
void vec2i_div_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Divides two vectors component-wise.
void vec2i_add_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)
Adds a scalar to each component.
void vec2i_sub_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)
Subtracts a scalar from each component.
void vec2i_mod_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Component-wise floor modulo of a by b.
void vec2i_div_floor_ptr(vector2i* res, const vector2i* a, const vector2i* b)
Component-wise floored division of a by b.
void vec2i_wrap_ptr(vector2i* res, const vector2i* v, const vector2i* period)
Wraps each component of v into [0, period).
void vec2i_to_vec3i_ptr(vector3i* res, const vector2i* v, vm_int_t z)
Converts a vector4i to a vector3i by dropping w.
void vec2i_normalize_to_vec2_ptr(vector2* res, const vector2i* v)
Converts to a unit-length vector2.
void vec3i_add_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Computes the component-wise sum of two vector3i.
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_mul_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)
Scales a vector3i by an integer scalar.
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_mul_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Computes the component-wise product (Hadamard) of two vector3i.
void vec3i_neg_ptr(vector3i* res, const vector3i* v)
Negates a vector3i (multiplies by -1).
void vec3i_abs_ptr(vector3i* res, const vector3i* v)
Computes the absolute value of each component of a vector3i.
void vec3i_normalize_ptr(vector3i* res, const vector3i* v)
Normalizes a vector3i to approximate unit length.
void vec3i_cross_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Computes the cross-product of two vector3i.
void vec3i_min_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Computes the component-wise minimum of two vector3i.
void vec3i_max_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Computes the component-wise maximum 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_lerp_ptr(vector3i* res, const vector3i* a, const vector3i* b, vm_float_t t)
Performs linear interpolation between two vector3i.
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_div_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Divides two vectors component-wise.
void vec3i_add_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)
Adds a scalar to each component.
void vec3i_sub_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)
Subtracts a scalar from each component.
void vec3i_mod_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Component-wise floor modulo of a by b.
void vec3i_div_floor_ptr(vector3i* res, const vector3i* a, const vector3i* b)
Component-wise floored division of a by b.
void vec3i_wrap_ptr(vector3i* res, const vector3i* v, const vector3i* period)
Wraps each component of v into [0, period).
void vec3i_from_vec2i_ptr(vector3i* res, const vector2i* v, vm_int_t z)
Builds a vector3i from a vector2i and z.
void vec3i_xy_ptr(vector2i* res, const vector3i* v)
Returns the x and y components as a 2D vector.
void vec3i_normalize_to_vec3_ptr(vector3* res, const vector3i* v)
Converts to a unit-length vector3.
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_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_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_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_mul_ptr(vector4i* res, const vector4i* a, const vector4i* b)
Multiplies the components of two vector4i and stores the result in res.
void vec4i_neg_ptr(vector4i* res, const vector4i* v)
Negates the components of a vector4i and stores the result in res.
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_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_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_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_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_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,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 vector4i to the range [min, max] and stores the result in res.
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, vm_int_t s)
Adds a scalar to each component.
void vec4i_sub_scalar_ptr(vector4i* res, const vector4i* v, 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).
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.
auto vec2_from(const vector2i* v) -> vector2
Converts a vector2i to a vector2.
auto vec2i_from(const vector2* v) -> vector2i
Converts a vector2 to a vector2i by truncation.
auto vec2i_from_floored(const vector2* v) -> vector2i
Converts a vector2 to a vector2i by flooring each component.
auto vec2i_from_rounded(const vector2* v) -> vector2i
Converts a vector2 to a vector2i by rounding each component.
auto vec3_from(const vector3i* v) -> vector3
Converts a vector3i to a vector3.
auto vec3i_from(const vector3* v) -> vector3i
Converts a vector3 to a vector3i by truncation.
auto vec3i_from_floored(const vector3* v) -> vector3i
Converts a vector3 to a vector3i by flooring each component.
auto vec3i_from_rounded(const vector3* v) -> vector3i
Converts a vector3 to a vector3i by rounding each component.
auto deg_to_rad(vm_float_t degrees) -> vm_float_t
Converts degrees to radians.
auto rad_to_deg(vm_float_t radians) -> vm_float_t
Converts radians to degrees.
auto vec2(vm_float_t x, vm_float_t y) -> vector2
Constructs a vector2 from x and y.
void vec2_assign(vector2* dest, const vector2* src)
Copies src into dest.
void vec2_assign_xy(vector2* dest, vm_float_t x, vm_float_t y)
Assigns x and y to dest.
void vec2_add_assign(vector2* dest, const vector2* src)
Adds src to dest in place.
auto vec3(vm_float_t x, vm_float_t y, vm_float_t z) -> vector3
Constructs a vector3 from x, y, and z.
void vec3_assign(vector3* dest, const vector3* src)
Copies src into dest.
void vec3_assign_xyz(vector3* dest, vm_float_t x, vm_float_t y, vm_float_t z)
Assigns x, y, and z to dest.
void vec3_add_assign(vector3* dest, const vector3* src)
Adds src to dest in place.
auto vec2i(vm_int_t x, vm_int_t y) -> vector2i
Constructs a vector2i from x and y.
void vec2i_assign(vector2i* dest, const vector2i* src)
Copies src into dest.
void vec2i_assign_xy(vector2i* dest, vm_int_t x, vm_int_t y)
Assigns x and y to dest.
void vec2i_add_assign(vector2i* dest, const vector2i* src)
Adds src to dest in place.
auto vec3i(vm_int_t x, vm_int_t y, vm_int_t z) -> vector3i
Constructs a vector3i from x, y, and z.
void vec3i_assign(vector3i* dest, const vector3i* src)
Copies src into dest.
void vec3i_assign_xyz(vector3i* dest, vm_int_t x, vm_int_t y, vm_int_t z)
Assigns x, y, and z to dest.
void vec3i_add_assign(vector3i* dest, const vector3i* src)
Adds src to dest in place.
auto vec2_eq(vector2 a, vector2 b) -> bool
Returns true if two vectors are equal within VECMAT_EPSILON.
auto vec3_eq(vector3 a, vector3 b) -> bool
Returns true if two vectors are equal within VECMAT_EPSILON.
auto vec4_eq(vector4 a, vector4 b) -> bool
Returns true if two vectors are equal within VECMAT_EPSILON.
auto vec2i_eq(vector2i a, vector2i b) -> bool
Returns true if two vectors are exactly equal.
auto vec3i_eq(vector3i a, vector3i b) -> bool
Returns true if two vectors are exactly equal.
auto vec4i_eq(vector4i a, vector4i b) -> bool
Returns true if two vectors are exactly equal.

Scalar-query pointer adapters

Header-only _ptr forms for functions that return a scalar or bool.

The by-value function is the body. Pointers must not be NULL. These are not SIMD kernels and are not exported from the library.

static auto vec2_dot_ptr(const vector2* a, const vector2* b) -> vm_float_t
Pointer adapter for vec2_dot().
static auto vec2_length_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_length().
static auto vec2_length_squared_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_length_squared().
static auto vec2_length_manhattan_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_length_manhattan().
static auto vec2_length_chebyshev_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_length_chebyshev().
static auto vec2_aspect_ratio_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_aspect_ratio().
static auto vec2_distance_ptr(const vector2* a, const vector2* b) -> vm_float_t
Pointer adapter for vec2_distance().
static auto vec2_distance_squared_ptr(const vector2* a, const vector2* b) -> vm_float_t
Pointer adapter for vec2_distance_squared().
static auto vec2_angle_ptr(const vector2* a, const vector2* b) -> vm_float_t
Pointer adapter for vec2_angle().
static auto vec2_cross_scalar_ptr(const vector2* a, const vector2* b) -> vm_float_t
Pointer adapter for vec2_cross_scalar().
static auto vec2_heading_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_heading().
static auto vec2_heading_deg_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_heading_deg().
static auto vec2_min_component_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_min_component().
static auto vec2_max_component_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_max_component().
static auto vec2_sum_ptr(const vector2* v) -> vm_float_t
Pointer adapter for vec2_sum().
static auto vec2_is_zero_ptr(const vector2* v) -> bool
Pointer adapter for vec2_is_zero().
static auto vec2_is_normalized_ptr(const vector2* v) -> bool
Pointer adapter for vec2_is_normalized().
static auto vec2_near_ptr(const vector2* a, const vector2* b, const vm_float_t eps) -> bool
Pointer adapter for vec2_near().
static auto vec3_dot_ptr(const vector3* a, const vector3* b) -> vm_float_t
Pointer adapter for vec3_dot().
static auto vec3_length_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_length().
static auto vec3_length_squared_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_length_squared().
static auto vec3_length_manhattan_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_length_manhattan().
static auto vec3_length_chebyshev_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_length_chebyshev().
static auto vec3_distance_ptr(const vector3* a, const vector3* b) -> vm_float_t
Pointer adapter for vec3_distance().
static auto vec3_distance_squared_ptr(const vector3* a, const vector3* b) -> vm_float_t
Pointer adapter for vec3_distance_squared().
static auto vec3_angle_ptr(const vector3* a, const vector3* b) -> vm_float_t
Pointer adapter for vec3_angle().
static auto vec3_signed_angle_ptr(const vector3* a, const vector3* b, const vector3* axis) -> vm_float_t
Pointer adapter for vec3_signed_angle().
static auto vec3_min_component_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_min_component().
static auto vec3_max_component_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_max_component().
static auto vec3_sum_ptr(const vector3* v) -> vm_float_t
Pointer adapter for vec3_sum().
static auto vec3_is_zero_ptr(const vector3* v) -> bool
Pointer adapter for vec3_is_zero().
static auto vec3_is_normalized_ptr(const vector3* v) -> bool
Pointer adapter for vec3_is_normalized().
static auto vec3_near_ptr(const vector3* a, const vector3* b, const vm_float_t eps) -> bool
Pointer adapter for vec3_near().
static auto vec4_dot_ptr(const vector4* a, const vector4* b) -> vm_float_t
Pointer adapter for vec4_dot().
static auto vec4_length_ptr(const vector4* v) -> vm_float_t
Pointer adapter for vec4_length().
static auto vec4_length_squared_ptr(const vector4* v) -> vm_float_t
Pointer adapter for vec4_length_squared().
static auto vec4_distance_ptr(const vector4* a, const vector4* b) -> vm_float_t
Pointer adapter for vec4_distance().
static auto vec4_distance_squared_ptr(const vector4* a, const vector4* b) -> vm_float_t
Pointer adapter for vec4_distance_squared().
static auto vec4_is_zero_ptr(const vector4* v) -> bool
Pointer adapter for vec4_is_zero().
static auto vec4_is_normalized_ptr(const vector4* v) -> bool
Pointer adapter for vec4_is_normalized().
static auto vec4_near_ptr(const vector4* a, const vector4* b, const vm_float_t eps) -> bool
Pointer adapter for vec4_near().
static auto vec2i_dot_ptr(const vector2i* a, const vector2i* b) -> vm_int_t
Pointer adapter for vec2i_dot().
static auto vec2i_cross_scalar_ptr(const vector2i* a, const vector2i* b) -> vm_int_t
Pointer adapter for vec2i_cross_scalar().
static auto vec2i_length_squared_ptr(const vector2i* v) -> vm_int_t
Pointer adapter for vec2i_length_squared().
static auto vec2i_distance_squared_ptr(const vector2i* a, const vector2i* b) -> vm_int_t
Pointer adapter for vec2i_distance_squared().
static auto vec2i_length_manhattan_ptr(const vector2i* v) -> vm_int_t
Pointer adapter for vec2i_length_manhattan().
static auto vec2i_length_chebyshev_ptr(const vector2i* v) -> vm_int_t
Pointer adapter for vec2i_length_chebyshev().
static auto vec2i_min_component_ptr(const vector2i* v) -> vm_int_t
Pointer adapter for vec2i_min_component().
static auto vec2i_max_component_ptr(const vector2i* v) -> vm_int_t
Pointer adapter for vec2i_max_component().
static auto vec2i_sum_ptr(const vector2i* v) -> vm_int_t
Pointer adapter for vec2i_sum().
static auto vec2i_length_ptr(const vector2i* v) -> vm_float_t
Pointer adapter for vec2i_length().
static auto vec2i_distance_ptr(const vector2i* a, const vector2i* b) -> vm_float_t
Pointer adapter for vec2i_distance().
static auto vec2i_angle_ptr(const vector2i* a, const vector2i* b) -> vm_float_t
Pointer adapter for vec2i_angle().
static auto vec2i_aspect_ratio_ptr(const vector2i* v) -> vm_float_t
Pointer adapter for vec2i_aspect_ratio().
static auto vec2i_is_zero_ptr(const vector2i* v) -> bool
Pointer adapter for vec2i_is_zero().
static auto vec3i_dot_ptr(const vector3i* a, const vector3i* b) -> vm_int_t
Pointer adapter for vec3i_dot().
static auto vec3i_length_squared_ptr(const vector3i* v) -> vm_int_t
Pointer adapter for vec3i_length_squared().
static auto vec3i_distance_squared_ptr(const vector3i* a, const vector3i* b) -> vm_int_t
Pointer adapter for vec3i_distance_squared().
static auto vec3i_length_manhattan_ptr(const vector3i* v) -> vm_int_t
Pointer adapter for vec3i_length_manhattan().
static auto vec3i_length_chebyshev_ptr(const vector3i* v) -> vm_int_t
Pointer adapter for vec3i_length_chebyshev().
static auto vec3i_min_component_ptr(const vector3i* v) -> vm_int_t
Pointer adapter for vec3i_min_component().
static auto vec3i_max_component_ptr(const vector3i* v) -> vm_int_t
Pointer adapter for vec3i_max_component().
static auto vec3i_sum_ptr(const vector3i* v) -> vm_int_t
Pointer adapter for vec3i_sum().
static auto vec3i_length_ptr(const vector3i* v) -> vm_float_t
Pointer adapter for vec3i_length().
static auto vec3i_distance_ptr(const vector3i* a, const vector3i* b) -> vm_float_t
Pointer adapter for vec3i_distance().
static auto vec3i_angle_ptr(const vector3i* a, const vector3i* b) -> vm_float_t
Pointer adapter for vec3i_angle().
static auto vec3i_is_zero_ptr(const vector3i* v) -> bool
Pointer adapter for vec3i_is_zero().
static auto vec4i_dot_ptr(const vector4i* a, const vector4i* b) -> vm_int_t
Pointer adapter for vec4i_dot().
static auto vec4i_length_squared_ptr(const vector4i* v) -> vm_int_t
Pointer adapter for vec4i_length_squared().
static auto vec4i_distance_squared_ptr(const vector4i* a, const vector4i* b) -> vm_int_t
Pointer adapter for vec4i_distance_squared().
static auto vec4i_length_manhattan_ptr(const vector4i* v) -> vm_int_t
Pointer adapter for vec4i_length_manhattan().
static auto vec4i_length_chebyshev_ptr(const vector4i* v) -> vm_int_t
Pointer adapter for vec4i_length_chebyshev().
static auto vec4i_min_component_ptr(const vector4i* v) -> vm_int_t
Pointer adapter for vec4i_min_component().
static auto vec4i_max_component_ptr(const vector4i* v) -> vm_int_t
Pointer adapter for vec4i_max_component().
static auto vec4i_sum_ptr(const vector4i* v) -> vm_int_t
Pointer adapter for vec4i_sum().
static auto vec4i_length_ptr(const vector4i* v) -> vm_float_t
Pointer adapter for vec4i_length().
static auto vec4i_distance_ptr(const vector4i* a, const vector4i* b) -> vm_float_t
Pointer adapter for vec4i_distance().
static auto vec4i_is_zero_ptr(const vector4i* v) -> bool
Pointer adapter for vec4i_is_zero().
static auto vec2_eq_ptr(const vector2* a, const vector2* b) -> bool
Pointer adapter for vec2_eq().
static auto vec3_eq_ptr(const vector3* a, const vector3* b) -> bool
Pointer adapter for vec3_eq().
static auto vec4_eq_ptr(const vector4* a, const vector4* b) -> bool
Pointer adapter for vec4_eq().
static auto vec2i_eq_ptr(const vector2i* a, const vector2i* b) -> bool
Pointer adapter for vec2i_eq().
static auto vec3i_eq_ptr(const vector3i* a, const vector3i* b) -> bool
Pointer adapter for vec3i_eq().
static auto vec4i_eq_ptr(const vector4i* a, const vector4i* b) -> bool
Pointer adapter for vec4i_eq().

Function documentation

vector2 vec2_add(vector2 a, vector2 b)

Adds two vectors component-wise.

Parameters
a The first vector.
b The second vector.
Returns The sum vector2.

vector2 vec2_sub(vector2 a, vector2 b)

Subtracts the second vector from the first component-wise.

Parameters
a The first vector.
b The second vector.
Returns The difference vector2.

vector2 vec2_mul_scalar(vector2 v, vm_float_t s)

Multiplies a vector by a scalar component-wise.

Parameters
v The input vector.
s The scalar multiplier.
Returns The scaled vector2.

vector2 vec2_div_scalar(vector2 v, vm_float_t s)

Divides a vector by a scalar component-wise.

Parameters
v The input vector.
s The scalar divisor (non-zero).
Returns The divided vector2.

vector2 vec2_mul(vector2 a, vector2 b)

Multiplies two vectors component-wise (Hadamard product).

Parameters
a The first vector.
b The second vector.
Returns The product vector2.

vector2 vec2_neg(vector2 v)

Negates the vector (multiplies each component by -1.0f).

Parameters
v The input vector.
Returns The negated vector2.

vector2 vec2_abs(vector2 v)

Returns the absolute values of each component.

Parameters
v The input vector.
Returns The absolute value vector2.

vector2 vec2_zero(void)

Returns a vector2 with both components set to 0.0f.

Returns The zero vector2.

vector2 vec2_one(void)

Returns a vector2 with both components set to 1.0f.

Returns The one vector2.

vector2 vec2_x_axis(vm_float_t x)

Returns a vector2 along the x-axis (y = 0.0f).

Parameters
x The x component value.
Returns The x-axis vector2.

vector2 vec2_y_axis(vm_float_t y)

Returns a vector2 along the y-axis (x = 0.0f).

Parameters
y The y component value.
Returns The y-axis vector2.

vector2 vec2_x_scale(vm_float_t x)

Returns a vector2 representing x-axis scaling (y = 1.0f).

Parameters
x The x scale factor.
Returns The x-scale vector2.

vector2 vec2_y_scale(vm_float_t y)

Returns a vector2 representing y-axis scaling (x = 1.0f).

Parameters
y The y scale factor.
Returns The y-scale vector2.

vector2 vec2_scale(vector2 v, vm_float_t s)

Scales a vector by a scalar component-wise.

Parameters
v The input vector.
s The scalar multiplier.
Returns The scaled vector2.

vector2 vec2_cross(vector2 a, vector2 b)

Computes the 2D cross-product as a vector.

Parameters
a The first vector.
b The second vector.
Returns The cross-product vector2.

vector2 vec2_normalize(vector2 v)

Normalizes the vector to unit length.

Parameters
v The input vector.
Returns The normalized vector2 (unchanged if zero length).

vector2 vec2_min(vector2 a, vector2 b)

Returns the component-wise minimum of two vectors.

Parameters
a The first vector.
b The second vector.
Returns The minimum vector2.

vector2 vec2_max(vector2 a, vector2 b)

Returns the component-wise maximum of two vectors.

Parameters
a The first vector.
b The second vector.
Returns The maximum vector2.

vector2 vec2_sign(vector2 v)

Returns the sign of each component (+1.0f, -1.0f, or 0.0f).

Parameters
v The input vector.
Returns The sign vector2.

vector2 vec2_floor(vector2 v)

Applies floor to each component.

Parameters
v The input vector.
Returns The floored vector2.

vector2 vec2_ceil(vector2 v)

Applies ceil to each component.

Parameters
v The input vector.
Returns The ceiled vector2.

vector2 vec2_round(vector2 v)

Applies round to each component.

Parameters
v The input vector.
Returns The rounded vector2.

vector2 vec2_perpendicular(vector2 v)

Returns the perpendicular vector (90 degrees counterclockwise).

Parameters
v The input vector.
Returns The perpendicular vector2.

vector2 vec2_reflect(vector2 v, vector2 normal)

Reflects vector v across the normal, storing the result in res.

Parameters
v The incident vector.
normal The unit normal vector.
Returns The reflected vector2.

vector2 vec2_project(vector2 a, vector2 b)

Projects the first vector onto the second.

Parameters
a The vector to project.
b The projection direction vector.
Returns The projected vector2.

vector2 vec2_tangent(vector2 v)

Returns the tangent vector perpendicular to the input (90 degrees clockwise).

Parameters
v The input vector.
Returns The tangent vector2.

vector2 vec2_rotate(vector2 v, vm_float_t radians)

Rotates the input vector counterclockwise by the given angle (radians).

Parameters
v The input vector.
radians The rotation angle in radians.
Returns The rotated vector2.

vector2 vec2_rotate_deg(vector2 v, vm_float_t degrees)

Rotates a vector2 by the given angle in degrees.

Parameters
v The vector2 to rotate.
degrees The rotation angle in degrees.
Returns The rotated vector2.

vector2 vec2_slide(vector2 v, vector2 normal)

Slides the input vector tangent to the normal (removes normal component).

Parameters
v The input vector.
normal The unit normal vector.
Returns The slid vector2.

vector2 vec2_clamp(vector2 v, vector2 min, vector2 max)

Clamps vector v component-wise between min and max.

Parameters
v The input vector.
min The minimum bounds vector.
max The maximum bounds vector.
Returns The clamped vector2.

vector2 vec2_lerp(vector2 a, vector2 b, vm_float_t t)

Linearly interpolates from a to b by t.

Parameters
a First input vector.
b Second input vector.
t Interpolation factor.
Returns The resulting vector2.

vector2 vec2_div(vector2 a, vector2 b)

Divides two vectors component-wise.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector2.

vector2 vec2_add_scalar(vector2 v, vm_float_t s)

Adds a scalar to each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector2.

vector2 vec2_sub_scalar(vector2 v, vm_float_t s)

Subtracts a scalar from each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector2.

vector2 vec2_clamp_scalar(vector2 v, vm_float_t min, vm_float_t max)

Clamps each component to the scalar range [min, max].

Parameters
v Input vector.
min Lower bound.
max Upper bound.
Returns The resulting vector2.

vector2 vec2_saturate(vector2 v)

Clamps each component to the range [0, 1].

Parameters
v Input vector.
Returns The resulting vector2.

vector2 vec2_fract(vector2 v)

Returns the fractional part of each component.

Parameters
v Input vector.
Returns The resulting vector2.

vector2 vec2_refract(vector2 incident, vector2 normal, vm_float_t eta)

Computes the refraction of incident across normal with ratio eta.

Parameters
incident Incident vector.
normal Surface normal.
eta Ratio of indices of refraction.
Returns The resulting vector2.

vector2 vec2_reject(vector2 a, vector2 b)

Returns the component of a orthogonal to b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector2.

vector2 vec2_splat(vm_float_t s)

Returns a vector with every component set to s.

Parameters
s Scalar value.
Returns The resulting vector2.

vector2 vec2_from_angle(vm_float_t radians)

Returns the unit vector at the given angle in radians.

Parameters
radians Angle in radians.
Returns The resulting vector2.

vector2 vec2_from_angle_deg(vm_float_t degrees)

Creates a vector2 from an angle given in degrees.

Parameters
degrees The angle in degrees.
Returns A unit vector2 representing the given angle.

The resulting vector has unit length and points in the direction specified by the angle. The angle is converted to radians internally before computing the cosine and sine.

vector2 vec2_rotate_around(vector2 v, vector2 pivot, vm_float_t radians)

Rotates v around pivot by angle radians.

Parameters
v Input vector.
pivot Rotation pivot.
radians Angle in radians.
Returns The resulting vector2.

vector2 vec2_rotate_around_deg(vector2 v, vector2 pivot, vm_float_t degrees)

Rotates a vector2 around a pivot point by the given angle in degrees.

Parameters
v The vector2 to rotate.
pivot The vector2 to rotate around.
degrees The rotation angle in degrees.
Returns The rotated vector2.

vector2 vec2_move_toward(vector2 current, vector2 target, vm_float_t max_delta)

Moves current toward target by at most max_delta.

Parameters
current Current position.
target Target position.
max_delta Maximum distance to move.
Returns The resulting vector2.

vector2 vec2_limit_length(vector2 v, vm_float_t max_len)

Clamps the vector length to max_len.

Parameters
v Input vector.
max_len Maximum length.
Returns The resulting vector2.

vector3 vec2_to_vec3(vector2 v, vm_float_t z)

Converts a vector2 to a vector3 using z.

Parameters
v Input vector.
z Z component.
Returns The resulting vector3.

vm_float_t vec2_dot(vector2 a, vector2 b)

Computes the dot product of two vectors.

Parameters
a The first vector.
b The second vector.
Returns The dot product scalar.

vm_float_t vec2_length(vector2 v)

Computes the length (magnitude) of the vector.

Parameters
v The input vector.
Returns The length scalar.

vm_float_t vec2_length_squared(vector2 v)

Returns the squared Euclidean length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2_length_manhattan(vector2 v)

Returns the Manhattan (L1) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2_length_chebyshev(vector2 v)

Returns the Chebyshev (L-inf) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2_aspect_ratio(vector2 v)

Computes the aspect ratio of the vector (x / y).

Parameters
v The input vector.
Returns The aspect ratio scalar.

Returns 0.0f if y == 0.0f.

vm_float_t vec2_distance(vector2 a, vector2 b)

Computes the Euclidean distance between two vectors (treated as points).

Parameters
a The first point.
b The second point.
Returns The distance scalar.

vm_float_t vec2_distance_squared(vector2 a, vector2 b)

Returns the squared Euclidean distance between a and b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting scalar.

vm_float_t vec2_angle(vector2 a, vector2 b)

Computes the angle between two vectors (in radians, range [0, PI]).

Parameters
a The first vector.
b The second vector.
Returns The angle scalar.

Returns 0.0f if either vector has zero length.

vm_float_t vec2_cross_scalar(vector2 a, vector2 b)

Returns the 2D cross product as a scalar (a.x*b.y - a.y*b.x).

Parameters
a First input vector.
b Second input vector.
Returns The resulting scalar.

vm_float_t vec2_heading(vector2 v)

Returns the heading angle of the vector in radians.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2_heading_deg(vector2 v)

Returns the heading angle of the vector in degrees.

Parameters
v The vector2 whose heading is to be calculated.
Returns The heading angle of the vector in degrees.

Computes the angle between the positive x-axis and the vector using atan2, then converts the result from radians to degrees.

vm_float_t vec2_min_component(vector2 v)

Returns the smallest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2_max_component(vector2 v)

Returns the largest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2_sum(vector2 v)

Returns the sum of all components.

Parameters
v Input vector.
Returns The resulting scalar.

bool vec2_is_zero(vector2 v)

Returns true if every component is zero.

Parameters
v Input vector.
Returns True if every component is zero.

bool vec2_is_normalized(vector2 v)

Returns true if the vector has unit length.

Parameters
v Input vector.
Returns True if the vector has unit length.

bool vec2_near(vector2 a, vector2 b, vm_float_t eps)

Returns true if a and b are within eps of each other.

Parameters
a First input vector.
b Second input vector.
eps Distance tolerance.
Returns True if a and b are within eps.

vector3 vec3_add(vector3 a, vector3 b)

Component-wise addition of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector3 vec3_sub(vector3 a, vector3 b)

Component-wise subtraction of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector3 vec3_mul_scalar(vector3 v, vm_float_t s)

Component-wise multiplication of vector by scalar.

Parameters
v The vector.
s The scalar.
Returns Result vector.

vector3 vec3_div_scalar(vector3 v, vm_float_t s)

Component-wise division of vector by scalar.

Parameters
v The vector.
s The scalar (non-zero).
Returns Result vector.

vector3 vec3_mul(vector3 a, vector3 b)

Component-wise multiplication of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector3 vec3_neg(vector3 v)

Negation of a vector.

Parameters
v The vector.
Returns The negated vector.

vector3 vec3_abs(vector3 v)

Computes the absolute value per component of a vector3.

Parameters
v The vector.
Returns The absolute vector3.

vector3 vec3_zero(void)

Returns a zero-initialized vector3.

Returns A vector3 with all components set to 0.0f.

vector3 vec3_one(void)

Returns a vector3 with all components set to 1.0f.

Returns A vector3 with all components set to 1.0f.

vector3 vec3_x_axis(vm_float_t x)

Returns a vector3 along the x-axis.

Parameters
x The x component value.
Returns A vector3 with (x, 0.0f, 0.0f).

vector3 vec3_y_axis(vm_float_t y)

Returns a vector3 along the y-axis.

Parameters
y The y component value.
Returns A vector3 with (0.0f, y, 0.0f).

vector3 vec3_z_axis(vm_float_t z)

Returns a vector3 along the z-axis.

Parameters
z The z component value.
Returns A vector3 with (0.0f, 0.0f, z).

vector3 vec3_x_scale(vm_float_t x)

Returns a vector3 for scaling along the x-axis.

Parameters
x The x scale factor.
Returns A vector3 with (x, 1.0f, 1.0f).

vector3 vec3_y_scale(vm_float_t y)

Returns a vector3 for scaling along the y-axis.

Parameters
y The y scale factor.
Returns A vector3 with (1.0f, y, 1.0f).

vector3 vec3_z_scale(vm_float_t z)

Returns a vector3 for scaling along the z-axis.

Parameters
z The z scale factor.
Returns A vector3 with (1.0f, 1.0f, z).

vector3 vec3_cross(vector3 a, vector3 b)

Computes the cross-product of two vector3.

Parameters
a First vector.
b Second vector.
Returns The cross-product (a × b).

vector3 vec3_normalize(vector3 v)

Normalizes a vector3 to unit length.

Parameters
v The vector (non-zero).
Returns The normalized vector.

vector3 vec3_min(vector3 a, vector3 b)

Computes the component-wise minimum of two vector3.

Parameters
a First vector.
b Second vector.
Returns Per-component min(a, b).

vector3 vec3_max(vector3 a, vector3 b)

Computes the component-wise maximum of two vector3.

Parameters
a First vector.
b Second vector.
Returns Per-component max(a, b).

vector3 vec3_sign(vector3 v)

Computes the sign per component of a vector3 (-1, 0, or 1).

Parameters
v The vector.
Returns The sign vector.

vector3 vec3_floor(vector3 v)

Applies the floor per component to a vector3.

Parameters
v The vector.
Returns The floored vector.

vector3 vec3_ceil(vector3 v)

Applies ceil per component to a vector3.

Parameters
v The vector.
Returns The ceiling vector.

vector3 vec3_round(vector3 v)

Applies round per component to a vector3.

Parameters
v The vector.
Returns The rounded vector.

vector3 vec3_reflect(vector3 incident, vector3 normal)

Reflects an incident vector over normal.

Parameters
incident The incident vector.
normal The surface normal.
Returns The reflected vector.

vector3 vec3_refract(vector3 incident, vector3 normal, vm_float_t eta)

Refracts an incident vector across an interface with a given normal and ratio of refraction eta.

Parameters
incident The incident vector.
normal The surface normal.
eta The ratio of refraction (eta = n1 / n2).
Returns The refracted vector, or incident if total internal reflection.

vector3 vec3_lerp(vector3 a, vector3 b, vm_float_t t)

Linearly interpolates between two vector3.

Parameters
a Start vector.
b End vector.
t Interpolation factor [0, 1].
Returns The interpolated vector (a * (1 - t) + b * t).

vector3 vec3_clamp(vector3 v, vector3 min, vector3 max)

Clamps a vector3 between min and max per component.

Parameters
v The vector.
min Minimum bounds.
max Maximum bounds.
Returns The clamped vector.

vector3 vec3_scale(vector3 v, vm_float_t s)

Scales the vector by a scalar.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector3.

vector3 vec3_div(vector3 a, vector3 b)

Divides two vectors component-wise.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector3.

vector3 vec3_add_scalar(vector3 v, vm_float_t s)

Adds a scalar to each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector3.

vector3 vec3_sub_scalar(vector3 v, vm_float_t s)

Subtracts a scalar from each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector3.

vector3 vec3_clamp_scalar(vector3 v, vm_float_t min, vm_float_t max)

Clamps each component to the scalar range [min, max].

Parameters
v Input vector.
min Lower bound.
max Upper bound.
Returns The resulting vector3.

vector3 vec3_saturate(vector3 v)

Clamps each component to the range [0, 1].

Parameters
v Input vector.
Returns The resulting vector3.

vector3 vec3_fract(vector3 v)

Returns the fractional part of each component.

Parameters
v Input vector.
Returns The resulting vector3.

vector3 vec3_project(vector3 a, vector3 b)

Projects a onto b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector3.

vector3 vec3_slide(vector3 v, vector3 normal)

Removes the component of v along normal.

Parameters
v Input vector.
normal Surface normal.
Returns The resulting vector3.

vector3 vec3_reject(vector3 a, vector3 b)

Returns the component of a orthogonal to b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector3.

vector3 vec3_rotate_axis(vector3 v, vector3 axis, vm_float_t radians)

Rotates v around axis by angle radians.

Parameters
v Input vector.
axis Rotation axis.
radians Angle in radians.
Returns The resulting vector3.

vector3 vec3_rotate_axis_deg(vector3 v, vector3 axis, vm_float_t degrees)

Rotates a vector around an arbitrary axis by a given angle in degrees.

Parameters
v The vector to rotate.
axis The axis of rotation. The axis vector is assumed to be normalized.
degrees The rotation angle in degrees.
Returns The rotated vector.

This is a convenience wrapper that converts degrees to radians and delegates to vec3_rotate_axis.

vector3 vec3_splat(vm_float_t s)

Returns a vector with every component set to s.

Parameters
s Scalar value.
Returns The resulting vector3.

vector3 vec3_from_vec2(vector2 v, vm_float_t z)

Builds a vector3 from a vector2 and z.

Parameters
v Input vector.
z Z component.
Returns The resulting vector3.

vector3 vec3_move_toward(vector3 current, vector3 target, vm_float_t max_delta)

Moves current toward target by at most max_delta.

Parameters
current Current position.
target Target position.
max_delta Maximum distance to move.
Returns The resulting vector3.

vector3 vec3_limit_length(vector3 v, vm_float_t max_len)

Clamps the vector length to max_len.

Parameters
v Input vector.
max_len Maximum length.
Returns The resulting vector3.

vector2 vec3_xy(vector3 v)

Returns the x and y components as a 2D vector.

Parameters
v Input vector.
Returns The resulting vector2.

void vec3_orthonormal_basis(vector3 n, vector3* t, vector3* b)

Builds a tangent and bitangent orthonormal to n.

Parameters
n Unit normal.
t Output tangent.
b Output bitangent.

vm_float_t vec3_dot(vector3 a, vector3 b)

Computes the dot product of two vector3.

Parameters
a First vector.
b Second vector.
Returns The dot product (a.x * b.x + a.y * b.y + a.z * b.z).

vm_float_t vec3_length(vector3 v)

Computes the length (magnitude) of a vector3.

Parameters
v The vector.
Returns The Euclidean length of v.

vm_float_t vec3_length_squared(vector3 v)

Returns the squared Euclidean length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec3_length_manhattan(vector3 v)

Returns the Manhattan (L1) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec3_length_chebyshev(vector3 v)

Returns the Chebyshev (L-inf) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec3_distance(vector3 a, vector3 b)

Computes the Euclidean distance between two vector3.

Parameters
a First vector.
b Second vector.
Returns The distance between a and b.

vm_float_t vec3_distance_squared(vector3 a, vector3 b)

Returns the squared Euclidean distance between a and b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting scalar.

vm_float_t vec3_angle(vector3 a, vector3 b)

Computes the angle between two non-zero vector3 in radians.

Parameters
a First vector.
b Second vector.
Returns The angle between the directions of a and b.

vm_float_t vec3_signed_angle(vector3 a, vector3 b, vector3 axis)

Returns the signed angle from a to b around axis.

Parameters
a First input vector.
b Second input vector.
axis Rotation axis.
Returns The resulting scalar.

vm_float_t vec3_min_component(vector3 v)

Returns the smallest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec3_max_component(vector3 v)

Returns the largest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec3_sum(vector3 v)

Returns the sum of all components.

Parameters
v Input vector.
Returns The resulting scalar.

bool vec3_is_zero(vector3 v)

Returns true if every component is zero.

Parameters
v Input vector.
Returns True if every component is zero.

bool vec3_is_normalized(vector3 v)

Returns true if the vector has unit length.

Parameters
v Input vector.
Returns True if the vector has unit length.

bool vec3_near(vector3 a, vector3 b, vm_float_t eps)

Returns true if a and b are within eps of each other.

Parameters
a First input vector.
b Second input vector.
eps Distance tolerance.
Returns True if a and b are within eps.

vector4 vec4_add(vector4 a, vector4 b)

Component-wise addition of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector4 vec4_sub(vector4 a, vector4 b)

Component-wise subtraction of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector4 vec4_mul_scalar(vector4 v, vm_float_t s)

Component-wise multiplication of vector by scalar.

Parameters
v The vector.
s The scalar.
Returns Result vector.

vector4 vec4_div_scalar(vector4 v, vm_float_t s)

Component-wise division of vector by scalar.

Parameters
v The vector.
s The scalar (non-zero).
Returns Result vector.

vector4 vec4_mul(vector4 a, vector4 b)

Component-wise multiplication of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector4 vec4_neg(vector4 v)

Negation of a vector.

Parameters
v The vector.
Returns The negated vector.

vector4 vec4_abs(vector4 v)

Computes the absolute value per component of a vector4.

Parameters
v The vector.
Returns The absolute vector4.

vector4 vec4_zero(void)

Returns a zero-initialized vector4.

Returns A vector4 with all components set to 0.0f.

vector4 vec4_one(void)

Returns a vector4 with all components set to 1.0f.

Returns A vector4 with all components set to 1.0f.

vector4 vec4_x_axis(vm_float_t x)

Returns a vector4 along the x-axis.

Parameters
x The x component value.
Returns A vector4 with (x, 0.0f, 0.0f, 0.0f).

vector4 vec4_y_axis(vm_float_t y)

Returns a vector4 along the y-axis.

Parameters
y The y component value.
Returns A vector4 with (0.0f, y, 0.0f, 0.0f).

vector4 vec4_z_axis(vm_float_t z)

Returns a vector4 along the z-axis.

Parameters
z The z component value.
Returns A vector4 with (0.0f, 0.0f, z, 0.0f).

vector4 vec4_w_axis(vm_float_t w)

Returns a vector4 along the w-axis.

Parameters
w The w component value.
Returns A vector4 with (0.0f, 0.0f, 0.0f, w).

vector4 vec4_x_scale(vm_float_t x)

Returns avector4 for scaling along the x-axis.

Parameters
x The x scale factor.
Returns A vector4 with (x, 1.0f, 1.0f, 1.0f).

vector4 vec4_y_scale(vm_float_t y)

Returns a vector4 for scaling along the y-axis.

Parameters
y The y scale factor.
Returns A vector4 with (1.0f, y, 1.0f, 1.0f).

vector4 vec4_z_scale(vm_float_t z)

Returns a vector4for scaling along the z-axis.

Parameters
z The z scale factor.
Returns A vector4 with (1.0f, 1.0f, z, 1.0f).

vector4 vec4_w_scale(vm_float_t w)

Returns a vector4 for scaling along the w-axis.

Parameters
w The w scale factor.
Returns A vector4 with (1.0f, 1.0f, 1.0f, w).

vector4 vec4_normalize(vector4 v)

Normalizes a vector4 to unit length.

Parameters
v The vector (non-zero).
Returns The normalized vector.

vector4 vec4_min(vector4 a, vector4 b)

Computes the component-wise minimum of two vector4.

Parameters
a First vector.
b Second vector.
Returns Per-component min(a, b).

vector4 vec4_max(vector4 a, vector4 b)

Computes the component-wise maximum of two vector4.

Parameters
a First vector.
b Second vector.
Returns Per-component max(a, b).

vector4 vec4_sign(vector4 v)

Computes the sign per component of a vector4 (-1, 0, or 1).

Parameters
v The vector.
Returns The sign vector.

vector4 vec4_floor(vector4 v)

Applies the floor per component to a vector4.

Parameters
v The vector.
Returns The floored vector.

vector4 vec4_ceil(vector4 v)

Applies ceil per component to a vector4.

Parameters
v The vector.
Returns The ceiling vector.

vector4 vec4_round(vector4 v)

Applies round per component to a vector4.

Parameters
v The vector.
Returns The rounded vector.

vector4 vec4_lerp(vector4 a, vector4 b, vm_float_t t)

Linearly interpolates between two vector4.

Parameters
a Start vector.
b End vector.
t Interpolation factor [0, 1].
Returns The interpolated vector (a * (1 - t) + b * t).

vector4 vec4_clamp(vector4 v, vector4 min, vector4 max)

Clamps a vector4 between min and max per component.

Parameters
v The vector.
min Minimum bounds.
max Maximum bounds.
Returns The clamped vector.

vector4 vec4_homogenize(vector4 v)

Homogenizes a vector4 (divides x, y, z by w).

Parameters
v The homogeneous vector (w != 0.0f).
Returns The normalized cartesian vector4.

vector4 vec4_div(vector4 a, vector4 b)

Divides two vectors component-wise.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector4.

vector4 vec4_add_scalar(vector4 v, vm_float_t s)

Adds a scalar to each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector4.

vector4 vec4_sub_scalar(vector4 v, vm_float_t s)

Subtracts a scalar from each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector4.

vector4 vec4_clamp_scalar(vector4 v, vm_float_t min, vm_float_t max)

Clamps each component to the scalar range [min, max].

Parameters
v Input vector.
min Lower bound.
max Upper bound.
Returns The resulting vector4.

vector4 vec4_saturate(vector4 v)

Clamps each component to the range [0, 1].

Parameters
v Input vector.
Returns The resulting vector4.

vector4 vec4_fract(vector4 v)

Returns the fractional part of each component.

Parameters
v Input vector.
Returns The resulting vector4.

vector4 vec4_project(vector4 a, vector4 b)

Projects a onto b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector4.

vector4 vec4_reject(vector4 a, vector4 b)

Returns the component of a orthogonal to b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector4.

vector4 vec4_slide(vector4 v, vector4 normal)

Removes the component of v along normal.

Parameters
v Input vector.
normal Surface normal.
Returns The resulting vector4.

vector4 vec4_splat(vm_float_t s)

Returns a vector with every component set to s.

Parameters
s Scalar value.
Returns The resulting vector4.

vector3 vec4_to_vec3(vector4 v)

Converts a vector4 to a vector3 (discards the w component).

Parameters
v The source vector4.
Returns A vector3 {v.x, v.y, v.z}.

vm_float_t vec4_dot(vector4 a, vector4 b)

Computes the dot product of two vector4.

Parameters
a First vector.
b Second vector.
Returns The dot product (a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w).

vm_float_t vec4_length(vector4 v)

Computes the length (magnitude) of a vector4.

Parameters
v The vector.
Returns The Euclidean length of v.

vm_float_t vec4_length_squared(vector4 v)

Returns the squared Euclidean length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec4_distance(vector4 a, vector4 b)

Computes the Euclidean distance between two vector4.

Parameters
a First vector.
b Second vector.
Returns The distance between a and b.

vm_float_t vec4_distance_squared(vector4 a, vector4 b)

Returns the squared Euclidean distance between a and b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting scalar.

bool vec4_is_zero(vector4 v)

Returns true if every component is zero.

Parameters
v Input vector.
Returns True if every component is zero.

bool vec4_is_normalized(vector4 v)

Returns true if the vector has unit length.

Parameters
v Input vector.
Returns True if the vector has unit length.

bool vec4_near(vector4 a, vector4 b, vm_float_t eps)

Returns true if a and b are within eps of each other.

Parameters
a First input vector.
b Second input vector.
eps Distance tolerance.
Returns True if a and b are within eps.

void vec2_add_ptr(vector2* res, const vector2* a, const vector2* b)

Adds vectors a and b component-wise, storing the result in res.

Parameters
res Output vector.
a Input vector a.
b Input vector b.

void vec2_sub_ptr(vector2* res, const vector2* a, const vector2* b)

Subtracts vector b from vector a component-wise, storing the result in res.

Parameters
res Output vector.
a Input vector a.
b Input vector b.

void vec2_mul_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)

Multiplies vector v by scalar s component-wise, storing the result in res.

Parameters
res Output vector.
v Input vector.
s Input scalar.

void vec2_div_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)

Divides vector v by scalar s component-wise, storing the result in res.

Parameters
res Output vector.
v Input vector.
s Input scalar.

void vec2_mul_ptr(vector2* res, const vector2* a, const vector2* b)

Multiplies vectors a and b component-wise, storing the result in res.

Parameters
res Output vector.
a Input vector a.
b Input vector b.

void vec2_neg_ptr(vector2* res, const vector2* v)

Negates the components of vector v, storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_abs_ptr(vector2* res, const vector2* v)

Computes the absolute values of the components of vector v, storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_normalize_ptr(vector2* res, const vector2* v)

Normalizes vector v to unit length, storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_min_ptr(vector2* res, const vector2* a, const vector2* b)

Computes the component-wise minimum of vectors a and b, storing the result in res.

Parameters
res Output vector.
a Input vector a.
b Input vector b.

void vec2_max_ptr(vector2* res, const vector2* a, const vector2* b)

Computes the component-wise maximum of vectors a and b, storing the result in res.

Parameters
res Output vector.
a Input vector a.
b Input vector b.

void vec2_sign_ptr(vector2* res, const vector2* v)

Sets each component of res to the sign of the corresponding component in v (+1, -1).

Parameters
res Output vector.
v Input vector.

void vec2_floor_ptr(vector2* res, const vector2* v)

Applies the floor function to each component of vector v, storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_ceil_ptr(vector2* res, const vector2* v)

Applies the ceil function to each component of vector v, storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_round_ptr(vector2* res, const vector2* v)

Applies the round function to each component of vector v, storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_perpendicular_ptr(vector2* res, const vector2* v)

Computes the perpendicular vector to v (90 degrees counterclockwise rotation), storing the result in res.

Parameters
res Output vector.
v Input vector.

void vec2_scale_ptr(vector2* res, const vector2* v, vm_float_t s)

Scales a vector by a scalar component-wise, storing the result in res.

Parameters
res Output vector.
v Input vector.
s Input scalar.

void vec2_cross_ptr(vector2* res, const vector2* a, const vector2* b)

Computes the 2D cross-product of a and b, storing the scalar value in res->x and 0 in res->y.

Parameters
res Output vector.
a Input vector a.
b Input vector b.

void vec2_reflect_ptr(vector2* res, const vector2* v, const vector2* normal)

Reflects vector v across the normal, storing the result in res.

Parameters
res Output vector.
v Input incident vector.
normal Input surface normal.

void vec2_project_ptr(vector2* res, const vector2* a, const vector2* b)

Projects vector a onto vector b (scalar projection scaled by b).

Parameters
res The output projected vector.
a The vector to project.
b The direction vector (non-zero length recommended).

void vec2_tangent_ptr(vector2* res, const vector2* v)

Computes a tangent vector perpendicular to the input (90 degrees clockwise).

Parameters
res The output tangent vector.
v The input vector.

Equivalent to (v.y, -v.x).

void vec2_rotate_ptr(vector2* result, const vector2* v, vm_float_t radians)

Rotates the input vector counterclockwise by the given angle (radians).

Parameters
result The output rotated vector.
v The input vector.
radians The rotation angle in radians.

Uses standard 2D rotation matrix.

void vec2_rotate_deg_ptr(vector2* result, const vector2* v, vm_float_t degrees)

Rotates vector v by the given angle in degrees, storing the result in result.

Parameters
result Output vector.
v Input vector.
degrees Rotation angle in degrees.

void vec2_slide_ptr(vector2* result, const vector2* v, const vector2* normal)

Slides the input vector tangent to the normal (removes normal component).

Parameters
result The output slid vector.
v The input vector.
normal The unit normal vector.

Formula: v - dot(v, normal) * normal (assumes unit normal).

void vec2_clamp_ptr(vector2* res, const vector2* v, const vector2* min, const vector2* max)

Clamps vector v component-wise between min and max.

Parameters
res Output vector.
v Input vector to clamp.
min Minimum bounds vector.
max Maximum bounds vector.

void vec2_lerp_ptr(vector2* res, const vector2* a, const vector2* b, vm_float_t t)

Linearly interpolates from a to b by t.

Parameters
res Output vector.
a First input vector.
b Second input vector.
t Interpolation factor.

void vec2_div_ptr(vector2* res, const vector2* a, const vector2* b)

Divides two vectors component-wise.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec2_add_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)

Adds a scalar to each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec2_sub_scalar_ptr(vector2* res, const vector2* v, vm_float_t s)

Subtracts a scalar from each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec2_clamp_scalar_ptr(vector2* res, const vector2* v, vm_float_t min, vm_float_t max)

Clamps each component to the scalar range [min, max].

Parameters
res Output vector.
v Input vector.
min Lower bound.
max Upper bound.

void vec2_saturate_ptr(vector2* res, const vector2* v)

Clamps each component to the range [0, 1].

Parameters
res Output vector.
v Input vector.

void vec2_fract_ptr(vector2* res, const vector2* v)

Returns the fractional part of each component.

Parameters
res Output vector.
v Input vector.

void vec2_refract_ptr(vector2* res, const vector2* incident, const vector2* normal, vm_float_t eta)

Computes the refraction of incident across normal with ratio eta.

Parameters
res Output vector.
incident Incident vector.
normal Surface normal.
eta Ratio of indices of refraction.

void vec2_reject_ptr(vector2* res, const vector2* a, const vector2* b)

Returns the component of a orthogonal to b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec2_rotate_around_ptr(vector2* res, const vector2* v, const vector2* pivot, vm_float_t radians)

Rotates v around pivot by angle radians.

Parameters
res Output vector.
v Input vector.
pivot Rotation pivot.
radians Angle in radians.

void vec2_rotate_around_deg_ptr(vector2* res, const vector2* v, const vector2* pivot, vm_float_t degrees)

Rotates vector v around the given pivot point by the specified angle in degrees.

Parameters
res Output vector storing the rotated result.
v Input vector to rotate.
pivot Pivot point around which to rotate.
degrees Rotation angle in degrees.

This function converts the input angle from degrees to radians and then delegates to the radian-based rotation routine.

void vec2_move_toward_ptr(vector2* res, const vector2* current, const vector2* target, vm_float_t max_delta)

Moves current toward target by at most max_delta.

Parameters
res Output vector.
current Current position.
target Target position.
max_delta Maximum distance to move.

void vec2_limit_length_ptr(vector2* res, const vector2* v, vm_float_t max_len)

Clamps the vector length to max_len.

Parameters
res Output vector.
v Input vector.
max_len Maximum length.

void vec2_to_vec3_ptr(vector3* res, const vector2* v, vm_float_t z)

Converts a vector2 to a vector3 with the given z.

Parameters
res Output vector.
v Input vector.
z Z component.

void vec3_add_ptr(vector3* res, const vector3* a, const vector3* b)

Component-wise addition of two vectors.

Parameters
res Result vector.
a First vector.
b Second vector.

void vec3_sub_ptr(vector3* res, const vector3* a, const vector3* b)

Component-wise subtraction of two vectors.

Parameters
res Result vector.
a First vector.
b Second vector.

void vec3_mul_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)

Component-wise multiplication of vector by scalar.

Parameters
res Result vector.
v Vector.
s Scalar.

void vec3_div_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)

Component-wise division of vector by scalar.

Parameters
res Result vector.
v Vector.
s Scalar.

void vec3_mul_ptr(vector3* res, const vector3* a, const vector3* b)

Component-wise multiplication of two vectors.

Parameters
res Result vector.
a First vector.
b Second vector.

void vec3_neg_ptr(vector3* res, const vector3* v)

Negation of a vector.

Parameters
res Result vector.
v Vector.

void vec3_abs_ptr(vector3* res, const vector3* v)

Computes the absolute value per component of a vector3.

Parameters
res Result vector.
v Vector.

void vec3_normalize_ptr(vector3* res, const vector3* v)

Normalize a vector to unit length.

Parameters
res Result vector.
v Vector.

void vec3_cross_ptr(vector3* res, const vector3* a, const vector3* b)

Compute cross-product of two vectors.

Parameters
res Result vector.
a First vector.
b Second vector.

void vec3_min_ptr(vector3* res, const vector3* a, const vector3* b)

Component-wise minimum of two vectors.

Parameters
res Result vector.
a First vector.
b Second vector.

void vec3_max_ptr(vector3* res, const vector3* a, const vector3* b)

Component-wise maximum of two vectors.

Parameters
res Result vector.
a First vector.
b Second vector.

void vec3_sign_ptr(vector3* res, const vector3* v)

Component-wise sign of a vector.

Parameters
res Result vector.
v Vector.

void vec3_floor_ptr(vector3* res, const vector3* v)

Component-wise floor of a vector.

Parameters
res Result vector.
v Vector.

void vec3_ceil_ptr(vector3* res, const vector3* v)

Component-wise ceil of a vector.

Parameters
res Result vector.
v Vector.

void vec3_round_ptr(vector3* res, const vector3* v)

Component-wise round of a vector.

Parameters
res Result vector.
v Vector.

void vec3_reflect_ptr(vector3* res, const vector3* incident, const vector3* normal)

Compute reflection of the incident vector over normal.

Parameters
res Result vector.
incident Incident vector.
normal Normal vector.

void vec3_refract_ptr(vector3* res, const vector3* incident, const vector3* normal, vm_float_t eta)

Compute refraction of the incident vector through normal with eta.

Parameters
res Result vector.
incident Incident vector.
normal Normal vector.
eta Refraction index ratio.

void vec3_lerp_ptr(vector3* res, const vector3* a, const vector3* b, vm_float_t t)

Linear interpolation between two vectors.

Parameters
res Result vector.
a Start vector.
b End vector.
t Interpolation factor.

void vec3_clamp_ptr(vector3* res, const vector3* v, const vector3* min, const vector3* max)

Clamp vector components between min and max.

Parameters
res Result vector.
v Vector.
min Minimum bounds.
max Maximum bounds.

void vec3_scale_ptr(vector3* res, const vector3* v, vm_float_t s)

Scales the vector by a scalar.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec3_div_ptr(vector3* res, const vector3* a, const vector3* b)

Divides two vectors component-wise.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec3_add_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)

Adds a scalar to each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec3_sub_scalar_ptr(vector3* res, const vector3* v, vm_float_t s)

Subtracts a scalar from each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec3_clamp_scalar_ptr(vector3* res, const vector3* v, vm_float_t min, vm_float_t max)

Clamps each component to the scalar range [min, max].

Parameters
res Output vector.
v Input vector.
min Lower bound.
max Upper bound.

void vec3_saturate_ptr(vector3* res, const vector3* v)

Clamps each component to the range [0, 1].

Parameters
res Output vector.
v Input vector.

void vec3_fract_ptr(vector3* res, const vector3* v)

Returns the fractional part of each component.

Parameters
res Output vector.
v Input vector.

void vec3_project_ptr(vector3* res, const vector3* a, const vector3* b)

Projects a onto b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec3_slide_ptr(vector3* res, const vector3* v, const vector3* normal)

Removes the component of v along normal.

Parameters
res Output vector.
v Input vector.
normal Surface normal.

void vec3_reject_ptr(vector3* res, const vector3* a, const vector3* b)

Returns the component of a orthogonal to b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec3_rotate_axis_ptr(vector3* res, const vector3* v, const vector3* axis, vm_float_t radians)

Rotates v around axis by angle radians.

Parameters
res Output vector.
v Input vector.
axis Rotation axis.
radians Angle in radians.

void vec3_rotate_axis_deg_ptr(vector3* res, const vector3* v, const vector3* axis, vm_float_t degrees)

Component-wise rotation of a vector around an axis by a given angle in degrees.

Parameters
res Result vector.
v Vector to rotate.
axis Rotation axis.
degrees Angle in degrees.

void vec3_from_vec2_ptr(vector3* res, const vector2* v, vm_float_t z)

Builds a higher-dimension vector from a vector2.

Parameters
res Output vector.
v Input vector.
z Z component.

void vec3_xy_ptr(vector2* res, const vector3* v)

Returns the x and y components as a 2D vector.

Parameters
res Output vector.
v Input vector.

void vec3_move_toward_ptr(vector3* res, const vector3* current, const vector3* target, vm_float_t max_delta)

Moves current toward target by at most max_delta.

Parameters
res Output vector.
current Current position.
target Target position.
max_delta Maximum distance to move.

void vec3_limit_length_ptr(vector3* res, const vector3* v, vm_float_t max_len)

Clamps the vector length to max_len.

Parameters
res Output vector.
v Input vector.
max_len Maximum length.

void vec3_orthonormal_basis_ptr(const vector3* n, vector3* t, vector3* b)

Builds a tangent and bitangent orthonormal to n.

Parameters
n Unit normal.
t Output tangent.
b Output bitangent.

void vec4_add_ptr(vector4* res, const vector4* a, const vector4* b)

Component-wise addition (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.

void vec4_sub_ptr(vector4* res, const vector4* a, const vector4* b)

Component-wise subtraction (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.

void vec4_mul_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)

Multiplies a vector by a scalar (dispatched).

Parameters
res Result vector.
v Input vector.
s Scalar.

void vec4_div_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)

Divides a vector by a scalar (dispatched).

Parameters
res Result vector.
v Input vector.
s Scalar.

void vec4_mul_ptr(vector4* res, const vector4* a, const vector4* b)

Component-wise multiplication (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.

void vec4_neg_ptr(vector4* res, const vector4* v)

Negates a vector (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_abs_ptr(vector4* res, const vector4* v)

Component-wise absolute value (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_normalize_ptr(vector4* res, const vector4* v)

Normalizes a vector (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_min_ptr(vector4* res, const vector4* a, const vector4* b)

Component-wise minimum (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.

void vec4_max_ptr(vector4* res, const vector4* a, const vector4* b)

Component-wise maximum (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.

void vec4_sign_ptr(vector4* res, const vector4* v)

Component-wise sign (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_floor_ptr(vector4* res, const vector4* v)

Component-wise floor (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_ceil_ptr(vector4* res, const vector4* v)

Component-wise ceil (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_round_ptr(vector4* res, const vector4* v)

Component-wise round (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_lerp_ptr(vector4* res, const vector4* a, const vector4* b, vm_float_t t)

Linear interpolation (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.
t Interpolation factor.

void vec4_clamp_ptr(vector4* res, const vector4* v, const vector4* min, const vector4* max)

Component-wise clamp (dispatched).

Parameters
res Result vector.
v Input vector.
min Lower bound.
max Upper bound.

void vec4_homogenize_ptr(vector4* res, const vector4* v)

Divides xyz by w (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_div_ptr(vector4* res, const vector4* a, const vector4* b)

Component-wise division (dispatched).

Parameters
res Result vector.
a First vector.
b Second vector.

void vec4_add_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)

Adds a scalar to each component (dispatched).

Parameters
res Result vector.
v Input vector.
s Scalar.

void vec4_sub_scalar_ptr(vector4* res, const vector4* v, vm_float_t s)

Subtracts a scalar from each component (dispatched).

Parameters
res Result vector.
v Input vector.
s Scalar.

void vec4_clamp_scalar_ptr(vector4* res, const vector4* v, vm_float_t min, vm_float_t max)

Clamps each component to a scalar range (dispatched).

Parameters
res Result vector.
v Input vector.
min Lower bound.
max Upper bound.

void vec4_saturate_ptr(vector4* res, const vector4* v)

Clamps each component to [0, 1] (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_fract_ptr(vector4* res, const vector4* v)

Component-wise fractional part (dispatched).

Parameters
res Result vector.
v Input vector.

void vec4_project_ptr(vector4* res, const vector4* a, const vector4* b)

Projects a onto b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec4_reject_ptr(vector4* res, const vector4* a, const vector4* b)

Returns the component of a orthogonal to b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec4_slide_ptr(vector4* res, const vector4* v, const vector4* normal)

Removes the component of v along normal.

Parameters
res Output vector.
v Input vector.
normal Surface normal.

void vec4_to_vec3_ptr(vector3* res, const vector4* v)

Copies the x, y, z components from a vector4 to a vector3.

Parameters
res Pointer to result vector3.
v Pointer to input vector4.

vector2i vec2i_add(vector2i a, vector2i b)

Adds two vectors component-wise.

Parameters
a The first vector.
b The second vector.
Returns The sum vector2i.

vector2i vec2i_sub(vector2i a, vector2i b)

Subtracts the second vector from the first component-wise.

Parameters
a The first vector.
b The second vector.
Returns The difference vector2i.

vector2i vec2i_mul_scalar(vector2i v, vm_int_t s)

Multiplies a vector by a scalar component-wise.

Parameters
v The input vector.
s The scalar multiplier.
Returns The scaled vector2i.

vector2i vec2i_div_scalar(vector2i v, vm_int_t s)

Divides a vector by a scalar component-wise (float division, truncated to int).

Parameters
v The input vector.
s The scalar divisor (sets to zero vector if zero).
Returns The divided vector2i.

vector2i vec2i_mul(vector2i a, vector2i b)

Multiplies two vectors component-wise (Hadamard product).

Parameters
a The first vector.
b The second vector.
Returns The product vector2i.

vector2i vec2i_neg(vector2i v)

Negates the vector (multiplies each component by -1).

Parameters
v The input vector.
Returns The negated vector2i.

vector2i vec2i_abs(vector2i v)

Returns the absolute values of each component.

Parameters
v The input vector.
Returns The absolute value vector2i.

vector2i vec2i_zero(void)

Returns a vector2i with both components set to 0.

Returns The zero vector2i.

vector2i vec2i_one(void)

Returns a vector2i with both components set to 1.

Returns The one vector2i.

vector2i vec2i_x_axis(vm_int_t x)

Returns a vector2i along the x-axis (y = 0).

Parameters
x The x component value.
Returns The x-axis vector2i.

vector2i vec2i_y_axis(vm_int_t y)

Returns a vector2i along the y-axis (x = 0).

Parameters
y The y component value.
Returns The y-axis vector2i.

vector2i vec2i_x_scale(vm_int_t x)

Returns a vector2i representing x-axis scaling (y = 1).

Parameters
x The x scale factor.
Returns The x-scale vector2i.

vector2i vec2i_y_scale(vm_int_t y)

Returns a vector2i representing y-axis scaling (x = 1).

Parameters
y The y scale factor.
Returns The y-scale vector2i.

vector2i vec2i_cross(vector2i a, vector2i b)

Computes the 2D cross-product as a vector.

Parameters
a The first vector.
b The second vector.
Returns The cross-product vector2i.

vector2i vec2i_normalize(vector2i v)

Normalizes the vector to approximate unit length (float length, truncated to int).

Parameters
v The input vector.
Returns The normalized vector2i (unchanged if zero length).

vector2i vec2i_min(vector2i a, vector2i b)

Returns the component-wise minimum of two vectors.

Parameters
a The first vector.
b The second vector.
Returns The minimum vector2i.

vector2i vec2i_max(vector2i a, vector2i b)

Returns the component-wise maximum of two vectors.

Parameters
a The first vector.
b The second vector.
Returns The maximum vector2i.

vector2i vec2i_sign(vector2i v)

Returns the sign of each component (+1, -1, or 0).

Parameters
v The input vector.
Returns The sign vector2i.

vector2i vec2i_perpendicular(vector2i v)

Returns the perpendicular vector (90 degrees counterclockwise).

Parameters
v The input vector.
Returns The perpendicular vector2i.

vector2i vec2i_lerp(vector2i a, vector2i b, vm_float_t t)

Linearly interpolates from a to b by t.

Parameters
a First input vector.
b Second input vector.
t Interpolation factor.
Returns The resulting vector2i.

vector2i vec2i_clamp(vector2i v, vector2i min, vector2i max)

Clamps each component between min and max.

Parameters
v Input vector.
min Lower bound.
max Upper bound.
Returns The resulting vector2i.

vector2i vec2i_div(vector2i a, vector2i b)

Divides two vectors component-wise.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector2i.

vector2i vec2i_add_scalar(vector2i v, vm_int_t s)

Adds a scalar to each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector2i.

vector2i vec2i_sub_scalar(vector2i v, vm_int_t s)

Subtracts a scalar from each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector2i.

vector2i vec2i_mod(vector2i a, vector2i b)

Component-wise floor modulo of a by b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector2i.

vector2i vec2i_div_floor(vector2i a, vector2i b)

Component-wise floored division of a by b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector2i.

vector2i vec2i_wrap(vector2i v, vector2i period)

Wraps each component of v into [0, period).

Parameters
v Input vector.
period Wrap period per component.
Returns The resulting vector2i.

vector2i vec2i_splat(vm_int_t s)

Returns a vector with every component set to s.

Parameters
s Scalar value.
Returns The resulting vector2i.

vector3i vec2i_to_vec3i(vector2i v, vm_int_t z)

Converts a vector2i to a vector3i using z.

Parameters
v Input vector.
z Z component.
Returns The resulting vector3i.

vector2 vec2i_normalize_to_vec2(vector2i v)

Converts to a unit-length vector2.

Parameters
v Input vector.
Returns The resulting vector2.

vm_int_t vec2i_dot(vector2i a, vector2i b)

Computes the dot product of two vectors.

Parameters
a The first vector.
b The second vector.
Returns The dot product (vm_int_t; may overflow).

vm_int_t vec2i_cross_scalar(vector2i a, vector2i b)

Returns the 2D cross product as a scalar (a.x*b.y - a.y*b.x).

Parameters
a First input vector.
b Second input vector.
Returns The resulting scalar.

vm_int_t vec2i_length_squared(vector2i v)

Returns the squared Euclidean length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec2i_distance_squared(vector2i a, vector2i 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 vec2i_length_manhattan(vector2i v)

Returns the Manhattan (L1) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec2i_length_chebyshev(vector2i v)

Returns the Chebyshev (L-inf) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec2i_min_component(vector2i v)

Returns the smallest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec2i_max_component(vector2i v)

Returns the largest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec2i_sum(vector2i v)

Returns the sum of all components.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec2i_length(vector2i v)

Computes the length (magnitude) of the vector.

Parameters
v The input vector.
Returns The length scalar.

vm_float_t vec2i_distance(vector2i a, vector2i b)

Computes the Euclidean distance between two vectors (treated as points).

Parameters
a The first point.
b The second point.
Returns The distance scalar.

vm_float_t vec2i_angle(vector2i a, vector2i b)

Computes the signed angle between two vectors (in radians, range [-PI, PI]) using atan2(cross, dot).

Parameters
a The first vector.
b The second vector.
Returns The signed angle scalar.

Returns 0.0f if either vector has zero length.

vm_float_t vec2i_aspect_ratio(vector2i v)

Computes the aspect ratio of the vector (x / y).

Parameters
v The input vector.
Returns The aspect ratio scalar.

Returns 0.0f if y == 0.

bool vec2i_is_zero(vector2i v)

Returns true if every component is zero.

Parameters
v Input vector.
Returns True if every component is zero.

vector3i vec3i_add(vector3i a, vector3i b)

Component-wise addition of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector3i vec3i_sub(vector3i a, vector3i b)

Component-wise subtraction of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector3i vec3i_mul_scalar(vector3i v, vm_int_t s)

Component-wise multiplication of vector by scalar.

Parameters
v The vector.
s The scalar.
Returns Result vector.

vector3i vec3i_div_scalar(vector3i v, vm_int_t s)

Component-wise division of vector by scalar.

Parameters
v The vector.
s The scalar (non-zero).
Returns Result vector.

vector3i vec3i_mul(vector3i a, vector3i b)

Component-wise multiplication of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector3i vec3i_neg(vector3i v)

Negation of a vector.

Parameters
v The vector.
Returns The negated vector.

vector3i vec3i_abs(vector3i v)

Computes the absolute value per component of a vector3i.

Parameters
v The vector.
Returns The absolute vector3i.

vector3i vec3i_zero(void)

Returns a zero-initialized vector3i.

Returns A vector3i with all components set to 0.

vector3i vec3i_one(void)

Returns a vector3i with all components set to 1.

Returns A vector3i with all components set to 1.

vector3i vec3i_x_axis(vm_int_t x)

Returns a vector3i along the x-axis.

Parameters
x The x component value.
Returns A vector3i with (x, 0, 0).

vector3i vec3i_y_axis(vm_int_t y)

Returns a vector3i along the y-axis.

Parameters
y The y component value.
Returns A vector3i with (0, y, 0).

vector3i vec3i_z_axis(vm_int_t z)

Returns a vector3i along the z-axis.

Parameters
z The z component value.
Returns A vector3i with (0, 0, z).

vector3i vec3i_x_scale(vm_int_t x)

Returns a vector3i for scaling along the x-axis.

Parameters
x The x scale factor.
Returns A vector3i with (x, 1, 1).

vector3i vec3i_y_scale(vm_int_t y)

Returns a vector3i for scaling along the y-axis.

Parameters
y The y scale factor.
Returns A vector3i with (1, y, 1).

vector3i vec3i_z_scale(vm_int_t z)

Returns a vector3i for scaling along the z-axis.

Parameters
z The z scale factor.
Returns A vector3i with (1, 1, z).

vector3i vec3i_cross(vector3i a, vector3i b)

Computes the cross-product of two vector3i.

Parameters
a First vector.
b Second vector.
Returns The cross-product (a × b).

vector3i vec3i_normalize(vector3i v)

Normalizes a vector3i to unit length.

Parameters
v The vector (non-zero).
Returns The normalized vector.

vector3i vec3i_min(vector3i a, vector3i b)

Computes the component-wise minimum of two vector3i.

Parameters
a First vector.
b Second vector.
Returns Per-component min(a, b).

vector3i vec3i_max(vector3i a, vector3i b)

Computes the component-wise maximum of two vector3i.

Parameters
a First vector.
b Second vector.
Returns Per-component max(a, b).

vector3i vec3i_sign(vector3i v)

Computes the sign per component of a vector3i (-1, 0, or 1).

Parameters
v The vector.
Returns The sign vector.

vector3i vec3i_lerp(vector3i a, vector3i b, vm_float_t t)

Linearly interpolates between two vector3i.

Parameters
a Start vector.
b End vector.
t Interpolation factor [0, 1].
Returns The interpolated vector (a * (1 - t) + b * t).

vector3i vec3i_clamp(vector3i v, vector3i min, vector3i max)

Clamps a vector3i between min and max per component.

Parameters
v The vector.
min Minimum bounds.
max Maximum bounds.
Returns The clamped vector.

vector3i vec3i_div(vector3i a, vector3i b)

Divides two vectors component-wise.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector3i.

vector3i vec3i_add_scalar(vector3i v, vm_int_t s)

Adds a scalar to each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector3i.

vector3i vec3i_sub_scalar(vector3i v, vm_int_t s)

Subtracts a scalar from each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector3i.

vector3i vec3i_mod(vector3i a, vector3i b)

Component-wise floor modulo of a by b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector3i.

vector3i vec3i_div_floor(vector3i a, vector3i b)

Component-wise floored division of a by b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector3i.

vector3i vec3i_wrap(vector3i v, vector3i period)

Wraps each component of v into [0, period).

Parameters
v Input vector.
period Wrap period per component.
Returns The resulting vector3i.

vector3i vec3i_splat(vm_int_t s)

Returns a vector with every component set to s.

Parameters
s Scalar value.
Returns The resulting vector3i.

vector3i vec3i_from_vec2i(vector2i v, vm_int_t z)

Builds a vector3i from a vector2i and z.

Parameters
v Input vector.
z Z component.
Returns The resulting vector3i.

vector2i vec3i_xy(vector3i v)

Returns the x and y components as a 2D vector.

Parameters
v Input vector.
Returns The resulting vector2i.

vector3 vec3i_normalize_to_vec3(vector3i v)

Converts to a unit-length vector3.

Parameters
v Input vector.
Returns The resulting vector3.

vm_int_t vec3i_dot(vector3i a, vector3i b)

Computes the dot product of two vector3i.

Parameters
a First vector.
b Second vector.
Returns The dot product (a.x * b.x + a.y * b.y + a.z * b.z).

vm_int_t vec3i_length_squared(vector3i v)

Returns the squared Euclidean length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec3i_distance_squared(vector3i a, vector3i 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 vec3i_length_manhattan(vector3i v)

Returns the Manhattan (L1) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec3i_length_chebyshev(vector3i v)

Returns the Chebyshev (L-inf) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec3i_min_component(vector3i v)

Returns the smallest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec3i_max_component(vector3i v)

Returns the largest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec3i_sum(vector3i v)

Returns the sum of all components.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec3i_length(vector3i v)

Computes the length (magnitude) of a vector3i.

Parameters
v The vector.
Returns The Euclidean length of v.

vm_float_t vec3i_distance(vector3i a, vector3i b)

Computes the Euclidean distance between two vector3i.

Parameters
a First vector.
b Second vector.
Returns The distance between a and b.

vm_float_t vec3i_angle(vector3i a, vector3i b)

Computes the angle between two non-zero vector3i in radians.

Parameters
a First vector.
b Second vector.
Returns The angle between the directions of a and b.

bool vec3i_is_zero(vector3i v)

Returns true if every component is zero.

Parameters
v Input vector.
Returns True if every component is zero.

vector4i vec4i_add(vector4i a, vector4i b)

Component-wise addition of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector4i vec4i_sub(vector4i a, vector4i b)

Component-wise subtraction of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector4i vec4i_mul_scalar(vector4i v, 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(vector4i v, 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_mul(vector4i a, vector4i b)

Component-wise multiplication of two vectors.

Parameters
a First vector.
b Second vector.
Returns Result vector.

vector4i vec4i_neg(vector4i v)

Negation of a vector.

Parameters
v The vector.
Returns The negated vector.

vector4i vec4i_abs(vector4i v)

Computes the absolute value per component of a vector4i.

Parameters
v The vector.
Returns The absolute vector4i.

vector4i vec4i_zero(void)

Returns a zero-initialized vector4i.

Returns A vector4i with all components set to 0.

vector4i vec4i_one(void)

Returns a vector4i with all components set to 1.

Returns A vector4i with all components set to 1.

vector4i vec4i_x_axis(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(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(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(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(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(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(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(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_normalize(vector4i v)

Normalizes a vector4i to unit length.

Parameters
v The vector (non-zero).
Returns The normalized vector.

vector4i vec4i_min(vector4i a, vector4i b)

Computes the component-wise minimum of two vector4i.

Parameters
a First vector.
b Second vector.
Returns Per-component min(a, b).

vector4i vec4i_max(vector4i a, vector4i b)

Computes the component-wise maximum of two vector4i.

Parameters
a First vector.
b Second vector.
Returns Per-component max(a, b).

vector4i vec4i_sign(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(vector4i a, vector4i b, 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(vector4i v, vector4i min, 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].

vector4i vec4i_div(vector4i a, vector4i b)

Divides two vectors component-wise.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector4i.

vector4i vec4i_add_scalar(vector4i v, 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(vector4i v, vm_int_t s)

Subtracts a scalar from each component.

Parameters
v Input vector.
s Scalar value.
Returns The resulting vector4i.

vector4i vec4i_mod(vector4i a, vector4i b)

Component-wise floor modulo of a by b.

Parameters
a First input vector.
b Second input vector.
Returns The resulting vector4i.

vector4i vec4i_div_floor(vector4i a, 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(vector4i v, 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(vm_int_t s)

Returns a vector with every component set to s.

Parameters
s Scalar value.
Returns The resulting vector4i.

vector3i vec4i_to_vec3i(vector4i v)

Converts a vector4i to a vector3i (discards the w component).

Parameters
v The source vector4i.
Returns A vector3i {v.x, v.y, v.z}.

vm_int_t vec4i_dot(vector4i a, vector4i b)

Computes the dot product of two vector4i.

Parameters
a First vector.
b Second vector.
Returns The dot product.

vm_int_t vec4i_length_squared(vector4i v)

Returns the squared Euclidean length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec4i_distance_squared(vector4i a, 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(vector4i v)

Returns the Manhattan (L1) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec4i_length_chebyshev(vector4i v)

Returns the Chebyshev (L-inf) length.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec4i_min_component(vector4i v)

Returns the smallest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec4i_max_component(vector4i v)

Returns the largest component.

Parameters
v Input vector.
Returns The resulting scalar.

vm_int_t vec4i_sum(vector4i v)

Returns the sum of all components.

Parameters
v Input vector.
Returns The resulting scalar.

vm_float_t vec4i_length(vector4i v)

Computes the length (magnitude) of a vector4i.

Parameters
v The vector.
Returns The Euclidean length of v.

vm_float_t vec4i_distance(vector4i a, vector4i b)

Computes the Euclidean distance between two vector4i.

Parameters
a First vector.
b Second vector.
Returns The distance between a and b.

bool vec4i_is_zero(vector4i v)

Returns true if every component is zero.

Parameters
v Input vector.
Returns True if every component is zero.

void vec2i_add_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Adds vectors a and b component-wise, storing the result in res.

Parameters
res Pointer to result vector2i.
a Pointer to first vector2i.
b Pointer to second vector2i.

void vec2i_sub_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Subtracts vector b from vector a component-wise, storing the result in res.

Parameters
res Pointer to result vector2i.
a Pointer to first vector2i.
b Pointer to second vector2i.

void vec2i_mul_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)

Multiplies vector v by scalar s component-wise, storing the result in res.

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.
s Scalar.

void vec2i_div_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)

Divides vector v by scalar s component-wise (float division, truncated to int), storing the result in res.

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.
s Scalar.

Sets vector to zero if s == 0.

void vec2i_mul_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Multiplies vectors a and b component-wise (Hadamard product), storing the result in res.

Parameters
res Pointer to result vector2i.
a Pointer to first vector2i.
b Pointer to second vector2i.

void vec2i_neg_ptr(vector2i* res, const vector2i* v)

Negates the components of vector v, storing the result in res.

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.

void vec2i_abs_ptr(vector2i* res, const vector2i* v)

Computes the absolute values of the components of vector v (using int abs), storing the result in res.

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.

void vec2i_normalize_ptr(vector2i* res, const vector2i* v)

Normalizes vector v to approximate unit length (float length computation, truncated to int), storing the result in res.

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.

Copies v unchanged if the length is zero.

void vec2i_min_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Computes the component-wise minimum of vectors a and b, storing the result in res.

Parameters
res Pointer to result vector2i.
a Pointer to first vector2i.
b Pointer to second vector2i.

void vec2i_max_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Computes the component-wise maximum of vectors a and b, storing the result in res.

Parameters
res Pointer to result vector2i.
a Pointer to first vector2i.
b Pointer to second vector2i.

void vec2i_sign_ptr(vector2i* res, const vector2i* v)

Sets each component of res to the sign of the corresponding component in v (+1, -1, or 0).

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.

void vec2i_perpendicular_ptr(vector2i* res, const vector2i* v)

Computes the perpendicular vector to v (90 degrees counterclockwise rotation), storing the result in res.

Parameters
res Pointer to result vector2i.
v Pointer to vector2i.

void vec2i_cross_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Computes the 2D cross-product of a and b, storing the scalar value in res->x and 0 in res->y.

Parameters
res Pointer to result vector2i.
a Pointer to first vector2i.
b Pointer to second vector2i.

void vec2i_lerp_ptr(vector2i* res, const vector2i* a, const vector2i* b, vm_float_t t)

Linearly interpolates from a to b by t.

Parameters
res Output vector.
a First input vector.
b Second input vector.
t Interpolation factor.

void vec2i_clamp_ptr(vector2i* res, const vector2i* v, const vector2i* min, const vector2i* max)

Clamps each component between min and max.

Parameters
res Output vector.
v Input vector.
min Lower bound.
max Upper bound.

void vec2i_div_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Divides two vectors component-wise.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec2i_add_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)

Adds a scalar to each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec2i_sub_scalar_ptr(vector2i* res, const vector2i* v, vm_int_t s)

Subtracts a scalar from each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec2i_mod_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Component-wise floor modulo of a by b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec2i_div_floor_ptr(vector2i* res, const vector2i* a, const vector2i* b)

Component-wise floored division of a by b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec2i_wrap_ptr(vector2i* res, const vector2i* v, const vector2i* period)

Wraps each component of v into [0, period).

Parameters
res Output vector.
v Input vector.
period Wrap period per component.

void vec2i_to_vec3i_ptr(vector3i* res, const vector2i* v, vm_int_t z)

Converts a vector4i to a vector3i by dropping w.

Parameters
res Output vector.
v Input vector.
z Z component.

void vec2i_normalize_to_vec2_ptr(vector2* res, const vector2i* v)

Converts to a unit-length vector2.

Parameters
res Output vector.
v Input vector.

void vec3i_add_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Computes the component-wise sum of two vector3i.

Parameters
res Pointer to the vector that will store the result.
a Pointer to the first vector.
b Pointer to the second vector.

void vec3i_sub_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Computes the component-wise difference of two vector3i (a minus b).

Parameters
res Pointer to the vector that will store the result.
a Pointer to the first vector.
b Pointer to the second vector.

void vec3i_mul_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)

Scales a vector3i by an integer scalar.

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.
s The scalar multiplier.

void vec3i_div_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)

Scales a vector3i by the inverse of an integer scalar.

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.
s The scalar divisor.

If the scalar is zero, stores the zero vector.

void vec3i_mul_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Computes the component-wise product (Hadamard) of two vector3i.

Parameters
res Pointer to the vector that will store the result.
a Pointer to the first vector.
b Pointer to the second vector.

void vec3i_neg_ptr(vector3i* res, const vector3i* v)

Negates a vector3i (multiplies by -1).

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.

void vec3i_abs_ptr(vector3i* res, const vector3i* v)

Computes the absolute value of each component of a vector3i.

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.

void vec3i_normalize_ptr(vector3i* res, const vector3i* v)

Normalizes a vector3i to approximate unit length.

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.

If the vector length is zero, copies the input vector.

void vec3i_cross_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Computes the cross-product of two vector3i.

Parameters
res Pointer to the vector that will store the result.
a Pointer to the first vector.
b Pointer to the second vector.

void vec3i_min_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Computes the component-wise minimum of two vector3i.

Parameters
res Pointer to the vector that will store the result.
a Pointer to the first vector.
b Pointer to the second vector.

void vec3i_max_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Computes the component-wise maximum of two vector3i.

Parameters
res Pointer to the vector that will store the result.
a Pointer to the first vector.
b Pointer to the second vector.

void vec3i_sign_ptr(vector3i* res, const vector3i* v)

Computes the sign of each component of a vector3i (-1, 0, or 1).

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.

void vec3i_lerp_ptr(vector3i* res, const vector3i* a, const vector3i* b, vm_float_t t)

Performs linear interpolation between two vector3i.

Parameters
res Pointer to the vector that will store the result.
a Pointer to the start vector.
b Pointer to the end vector.
t Interpolation factor (typically between 0.0 and 1.0).

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.

Parameters
res Pointer to the vector that will store the result.
v Pointer to the input vector.
min Pointer to the minimum bounds vector.
max Pointer to the maximum bounds vector.

void vec3i_div_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Divides two vectors component-wise.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec3i_add_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)

Adds a scalar to each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec3i_sub_scalar_ptr(vector3i* res, const vector3i* v, vm_int_t s)

Subtracts a scalar from each component.

Parameters
res Output vector.
v Input vector.
s Scalar value.

void vec3i_mod_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Component-wise floor modulo of a by b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec3i_div_floor_ptr(vector3i* res, const vector3i* a, const vector3i* b)

Component-wise floored division of a by b.

Parameters
res Output vector.
a First input vector.
b Second input vector.

void vec3i_wrap_ptr(vector3i* res, const vector3i* v, const vector3i* period)

Wraps each component of v into [0, period).

Parameters
res Output vector.
v Input vector.
period Wrap period per component.

void vec3i_from_vec2i_ptr(vector3i* res, const vector2i* v, vm_int_t z)

Builds a vector3i from a vector2i and z.

Parameters
res Output vector.
v Input vector.
z Z component.

void vec3i_xy_ptr(vector2i* res, const vector3i* v)

Returns the x and y components as a 2D vector.

Parameters
res Output vector.
v Input vector.

void vec3i_normalize_to_vec3_ptr(vector3* res, const vector3i* v)

Converts to a unit-length vector3.

Parameters
res Output vector.
v Input vector.

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, 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, 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, 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

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, 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, 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.

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.

Parameters
res Pointer to result vector3i
v Pointer to source vector4i

vector2 vec2_from(const vector2i* v)

Converts a vector2i to a vector2.

Parameters
v Input integer vector.
Returns The resulting vector2.

vector2i vec2i_from(const vector2* v)

Converts a vector2 to a vector2i by truncation.

Parameters
v Input vector.
Returns The resulting vector2i.

vector2i vec2i_from_floored(const vector2* v)

Converts a vector2 to a vector2i by flooring each component.

Parameters
v Input vector.
Returns The resulting vector2i.

vector2i vec2i_from_rounded(const vector2* v)

Converts a vector2 to a vector2i by rounding each component.

Parameters
v Input vector.
Returns The resulting vector2i.

vector3 vec3_from(const vector3i* v)

Converts a vector3i to a vector3.

Parameters
v Input integer vector.
Returns The resulting vector3.

vector3i vec3i_from(const vector3* v)

Converts a vector3 to a vector3i by truncation.

Parameters
v Input vector.
Returns The resulting vector3i.

vector3i vec3i_from_floored(const vector3* v)

Converts a vector3 to a vector3i by flooring each component.

Parameters
v Input vector.
Returns The resulting vector3i.

vector3i vec3i_from_rounded(const vector3* v)

Converts a vector3 to a vector3i by rounding each component.

Parameters
v Input vector.
Returns The resulting vector3i.

vm_float_t deg_to_rad(vm_float_t degrees)

Converts degrees to radians.

Parameters
degrees Angle in degrees.
Returns The angle in radians.

vm_float_t rad_to_deg(vm_float_t radians)

Converts radians to degrees.

Parameters
radians Angle in radians.
Returns The angle in degrees.

vector2 vec2(vm_float_t x, vm_float_t y)

Constructs a vector2 from x and y.

Parameters
x X component.
y Y component.
Returns The resulting vector2.

void vec2_assign(vector2* dest, const vector2* src)

Copies src into dest.

Parameters
dest Destination vector.
src Source vector.

void vec2_assign_xy(vector2* dest, vm_float_t x, vm_float_t y)

Assigns x and y to dest.

Parameters
dest Destination vector.
x X component.
y Y component.

void vec2_add_assign(vector2* dest, const vector2* src)

Adds src to dest in place.

Parameters
dest Destination vector.
src Vector to add.

vector3 vec3(vm_float_t x, vm_float_t y, vm_float_t z)

Constructs a vector3 from x, y, and z.

Parameters
x X component.
y Y component.
z Z component.
Returns The resulting vector3.

void vec3_assign(vector3* dest, const vector3* src)

Copies src into dest.

Parameters
dest Destination vector.
src Source vector.

void vec3_assign_xyz(vector3* dest, vm_float_t x, vm_float_t y, vm_float_t z)

Assigns x, y, and z to dest.

Parameters
dest Destination vector.
x X component.
y Y component.
z Z component.

void vec3_add_assign(vector3* dest, const vector3* src)

Adds src to dest in place.

Parameters
dest Destination vector.
src Vector to add.

vector2i vec2i(vm_int_t x, vm_int_t y)

Constructs a vector2i from x and y.

Parameters
x X component.
y Y component.
Returns The resulting vector2i.

void vec2i_assign(vector2i* dest, const vector2i* src)

Copies src into dest.

Parameters
dest Destination vector.
src Source vector.

void vec2i_assign_xy(vector2i* dest, vm_int_t x, vm_int_t y)

Assigns x and y to dest.

Parameters
dest Destination vector.
x X component.
y Y component.

void vec2i_add_assign(vector2i* dest, const vector2i* src)

Adds src to dest in place.

Parameters
dest Destination vector.
src Vector to add.

vector3i vec3i(vm_int_t x, vm_int_t y, vm_int_t z)

Constructs a vector3i from x, y, and z.

Parameters
x X component.
y Y component.
z Z component.
Returns The resulting vector3i.

void vec3i_assign(vector3i* dest, const vector3i* src)

Copies src into dest.

Parameters
dest Destination vector.
src Source vector.

void vec3i_assign_xyz(vector3i* dest, vm_int_t x, vm_int_t y, vm_int_t z)

Assigns x, y, and z to dest.

Parameters
dest Destination vector.
x X component.
y Y component.
z Z component.

void vec3i_add_assign(vector3i* dest, const vector3i* src)

Adds src to dest in place.

Parameters
dest Destination vector.
src Vector to add.

bool vec2_eq(vector2 a, vector2 b)

Returns true if two vectors are equal within VECMAT_EPSILON.

Parameters
a First vector.
b Second vector.
Returns True if a and b are approximately equal.

bool vec3_eq(vector3 a, vector3 b)

Returns true if two vectors are equal within VECMAT_EPSILON.

Parameters
a First vector.
b Second vector.
Returns True if a and b are approximately equal.

bool vec4_eq(vector4 a, vector4 b)

Returns true if two vectors are equal within VECMAT_EPSILON.

Parameters
a First vector.
b Second vector.
Returns True if a and b are approximately equal.

bool vec2i_eq(vector2i a, vector2i b)

Returns true if two vectors are exactly equal.

Parameters
a First vector.
b Second vector.
Returns True if a and b are equal.

bool vec3i_eq(vector3i a, vector3i b)

Returns true if two vectors are exactly equal.

Parameters
a First vector.
b Second vector.
Returns True if a and b are equal.

bool vec4i_eq(vector4i a, vector4i b)

Returns true if two vectors are exactly equal.

Parameters
a First vector.
b Second vector.
Returns True if a and b are equal.

static vm_float_t vec2_dot_ptr(const vector2* a, const vector2* b)

Pointer adapter for vec2_dot().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_length_ptr(const vector2* v)

Pointer adapter for vec2_length().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_length_squared_ptr(const vector2* v)

Pointer adapter for vec2_length_squared().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_length_manhattan_ptr(const vector2* v)

Pointer adapter for vec2_length_manhattan().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_length_chebyshev_ptr(const vector2* v)

Pointer adapter for vec2_length_chebyshev().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_aspect_ratio_ptr(const vector2* v)

Pointer adapter for vec2_aspect_ratio().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_distance_ptr(const vector2* a, const vector2* b)

Pointer adapter for vec2_distance().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_distance_squared_ptr(const vector2* a, const vector2* b)

Pointer adapter for vec2_distance_squared().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_angle_ptr(const vector2* a, const vector2* b)

Pointer adapter for vec2_angle().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_cross_scalar_ptr(const vector2* a, const vector2* b)

Pointer adapter for vec2_cross_scalar().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_heading_ptr(const vector2* v)

Pointer adapter for vec2_heading().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_heading_deg_ptr(const vector2* v)

Pointer adapter for vec2_heading_deg().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_min_component_ptr(const vector2* v)

Pointer adapter for vec2_min_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_max_component_ptr(const vector2* v)

Pointer adapter for vec2_max_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2_sum_ptr(const vector2* v)

Pointer adapter for vec2_sum().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec2_is_zero_ptr(const vector2* v)

Pointer adapter for vec2_is_zero().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec2_is_normalized_ptr(const vector2* v)

Pointer adapter for vec2_is_normalized().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec2_near_ptr(const vector2* a, const vector2* b, const vm_float_t eps)

Pointer adapter for vec2_near().

Parameters
a Must not be NULL.
b Must not be NULL.
eps Passed through to vec2_near().
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_dot_ptr(const vector3* a, const vector3* b)

Pointer adapter for vec3_dot().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_length_ptr(const vector3* v)

Pointer adapter for vec3_length().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_length_squared_ptr(const vector3* v)

Pointer adapter for vec3_length_squared().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_length_manhattan_ptr(const vector3* v)

Pointer adapter for vec3_length_manhattan().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_length_chebyshev_ptr(const vector3* v)

Pointer adapter for vec3_length_chebyshev().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_distance_ptr(const vector3* a, const vector3* b)

Pointer adapter for vec3_distance().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_distance_squared_ptr(const vector3* a, const vector3* b)

Pointer adapter for vec3_distance_squared().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_angle_ptr(const vector3* a, const vector3* b)

Pointer adapter for vec3_angle().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_signed_angle_ptr(const vector3* a, const vector3* b, const vector3* axis)

Pointer adapter for vec3_signed_angle().

Parameters
a Must not be NULL.
b Must not be NULL.
axis Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_min_component_ptr(const vector3* v)

Pointer adapter for vec3_min_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_max_component_ptr(const vector3* v)

Pointer adapter for vec3_max_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3_sum_ptr(const vector3* v)

Pointer adapter for vec3_sum().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec3_is_zero_ptr(const vector3* v)

Pointer adapter for vec3_is_zero().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec3_is_normalized_ptr(const vector3* v)

Pointer adapter for vec3_is_normalized().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec3_near_ptr(const vector3* a, const vector3* b, const vm_float_t eps)

Pointer adapter for vec3_near().

Parameters
a Must not be NULL.
b Must not be NULL.
eps Passed through to vec3_near().
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4_dot_ptr(const vector4* a, const vector4* b)

Pointer adapter for vec4_dot().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4_length_ptr(const vector4* v)

Pointer adapter for vec4_length().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4_length_squared_ptr(const vector4* v)

Pointer adapter for vec4_length_squared().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4_distance_ptr(const vector4* a, const vector4* b)

Pointer adapter for vec4_distance().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4_distance_squared_ptr(const vector4* a, const vector4* b)

Pointer adapter for vec4_distance_squared().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec4_is_zero_ptr(const vector4* v)

Pointer adapter for vec4_is_zero().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec4_is_normalized_ptr(const vector4* v)

Pointer adapter for vec4_is_normalized().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec4_near_ptr(const vector4* a, const vector4* b, const vm_float_t eps)

Pointer adapter for vec4_near().

Parameters
a Must not be NULL.
b Must not be NULL.
eps Passed through to vec4_near().
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_dot_ptr(const vector2i* a, const vector2i* b)

Pointer adapter for vec2i_dot().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_cross_scalar_ptr(const vector2i* a, const vector2i* b)

Pointer adapter for vec2i_cross_scalar().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_length_squared_ptr(const vector2i* v)

Pointer adapter for vec2i_length_squared().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_distance_squared_ptr(const vector2i* a, const vector2i* b)

Pointer adapter for vec2i_distance_squared().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_length_manhattan_ptr(const vector2i* v)

Pointer adapter for vec2i_length_manhattan().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_length_chebyshev_ptr(const vector2i* v)

Pointer adapter for vec2i_length_chebyshev().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_min_component_ptr(const vector2i* v)

Pointer adapter for vec2i_min_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_max_component_ptr(const vector2i* v)

Pointer adapter for vec2i_max_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec2i_sum_ptr(const vector2i* v)

Pointer adapter for vec2i_sum().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2i_length_ptr(const vector2i* v)

Pointer adapter for vec2i_length().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2i_distance_ptr(const vector2i* a, const vector2i* b)

Pointer adapter for vec2i_distance().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2i_angle_ptr(const vector2i* a, const vector2i* b)

Pointer adapter for vec2i_angle().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec2i_aspect_ratio_ptr(const vector2i* v)

Pointer adapter for vec2i_aspect_ratio().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec2i_is_zero_ptr(const vector2i* v)

Pointer adapter for vec2i_is_zero().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_dot_ptr(const vector3i* a, const vector3i* b)

Pointer adapter for vec3i_dot().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_length_squared_ptr(const vector3i* v)

Pointer adapter for vec3i_length_squared().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_distance_squared_ptr(const vector3i* a, const vector3i* b)

Pointer adapter for vec3i_distance_squared().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_length_manhattan_ptr(const vector3i* v)

Pointer adapter for vec3i_length_manhattan().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_length_chebyshev_ptr(const vector3i* v)

Pointer adapter for vec3i_length_chebyshev().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_min_component_ptr(const vector3i* v)

Pointer adapter for vec3i_min_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_max_component_ptr(const vector3i* v)

Pointer adapter for vec3i_max_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec3i_sum_ptr(const vector3i* v)

Pointer adapter for vec3i_sum().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3i_length_ptr(const vector3i* v)

Pointer adapter for vec3i_length().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3i_distance_ptr(const vector3i* a, const vector3i* b)

Pointer adapter for vec3i_distance().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec3i_angle_ptr(const vector3i* a, const vector3i* b)

Pointer adapter for vec3i_angle().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec3i_is_zero_ptr(const vector3i* v)

Pointer adapter for vec3i_is_zero().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_dot_ptr(const vector4i* a, const vector4i* b)

Pointer adapter for vec4i_dot().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_length_squared_ptr(const vector4i* v)

Pointer adapter for vec4i_length_squared().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_distance_squared_ptr(const vector4i* a, const vector4i* b)

Pointer adapter for vec4i_distance_squared().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_length_manhattan_ptr(const vector4i* v)

Pointer adapter for vec4i_length_manhattan().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_length_chebyshev_ptr(const vector4i* v)

Pointer adapter for vec4i_length_chebyshev().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_min_component_ptr(const vector4i* v)

Pointer adapter for vec4i_min_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_max_component_ptr(const vector4i* v)

Pointer adapter for vec4i_max_component().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_int_t vec4i_sum_ptr(const vector4i* v)

Pointer adapter for vec4i_sum().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4i_length_ptr(const vector4i* v)

Pointer adapter for vec4i_length().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static vm_float_t vec4i_distance_ptr(const vector4i* a, const vector4i* b)

Pointer adapter for vec4i_distance().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec4i_is_zero_ptr(const vector4i* v)

Pointer adapter for vec4i_is_zero().

Parameters
v Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec2_eq_ptr(const vector2* a, const vector2* b)

Pointer adapter for vec2_eq().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec3_eq_ptr(const vector3* a, const vector3* b)

Pointer adapter for vec3_eq().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec4_eq_ptr(const vector4* a, const vector4* b)

Pointer adapter for vec4_eq().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec2i_eq_ptr(const vector2i* a, const vector2i* b)

Pointer adapter for vec2i_eq().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec3i_eq_ptr(const vector3i* a, const vector3i* b)

Pointer adapter for vec3i_eq().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.

static bool vec4i_eq_ptr(const vector4i* a, const vector4i* b)

Pointer adapter for vec4i_eq().

Parameters
a Must not be NULL.
b Must not be NULL.
Returns Same value as the by-value function.

Same result as the by-value function.