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
vector2with both components set to 0.0f. - auto vec2_one(void) -> vector2
- Returns a
vector2with both components set to 1.0f. -
auto vec2_x_axis(vm_
float_ t x) -> vector2 - Returns a
vector2along the x-axis (y = 0.0f). -
auto vec2_y_axis(vm_
float_ t y) -> vector2 - Returns a
vector2along the y-axis (x = 0.0f). -
auto vec2_x_scale(vm_
float_ t x) -> vector2 - Returns a
vector2representing x-axis scaling (y = 1.0f). -
auto vec2_y_scale(vm_
float_ t y) -> vector2 - Returns a
vector2representing 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
vector2by 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
vector2from 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
vector3with all components set to 1.0f. -
auto vec3_x_axis(vm_
float_ t x) -> vector3 - Returns a
vector3along the x-axis. -
auto vec3_y_axis(vm_
float_ t y) -> vector3 - Returns a
vector3along the y-axis. -
auto vec3_z_axis(vm_
float_ t z) -> vector3 - Returns a
vector3along the z-axis. -
auto vec3_x_scale(vm_
float_ t x) -> vector3 - Returns a
vector3for scaling along the x-axis. -
auto vec3_y_scale(vm_
float_ t y) -> vector3 - Returns a
vector3for scaling along the y-axis. -
auto vec3_z_scale(vm_
float_ t z) -> vector3 - Returns a
vector3for 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
vector3between 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
vector3in 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
vector4with all components set to 1.0f. -
auto vec4_x_axis(vm_
float_ t x) -> vector4 - Returns a
vector4along the x-axis. -
auto vec4_y_axis(vm_
float_ t y) -> vector4 - Returns a
vector4along the y-axis. -
auto vec4_z_axis(vm_
float_ t z) -> vector4 - Returns a
vector4along the z-axis. -
auto vec4_w_axis(vm_
float_ t w) -> vector4 - Returns a
vector4along the w-axis. -
auto vec4_x_scale(vm_
float_ t x) -> vector4 - Returns a
vector4for scaling along the x-axis. -
auto vec4_y_scale(vm_
float_ t y) -> vector4 - Returns a
vector4for 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
vector4to 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
vector4between 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
vector4to avector3(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
aonto vectorb(scalar projection scaled byb). - 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
vector4to avector3. - 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
vector2iwith both components set to 0. - auto vec2i_one(void) -> vector2i
- Returns a
vector2iwith both components set to 1. -
auto vec2i_x_axis(vm_
int_ t x) -> vector2i - Returns a
vector2ialong the x-axis (y = 0). -
auto vec2i_y_axis(vm_
int_ t y) -> vector2i - Returns a
vector2ialong the y-axis (x = 0). -
auto vec2i_x_scale(vm_
int_ t x) -> vector2i - Returns a
vector2irepresenting x-axis scaling (y = 1). -
auto vec2i_y_scale(vm_
int_ t y) -> vector2i - Returns a
vector2irepresenting 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
vector3iwith all components set to 1. -
auto vec3i_x_axis(vm_
int_ t x) -> vector3i - Returns a
vector3ialong the x-axis. -
auto vec3i_y_axis(vm_
int_ t y) -> vector3i - Returns a
vector3ialong the y-axis. -
auto vec3i_z_axis(vm_
int_ t z) -> vector3i - Returns a
vector3ialong the z-axis. -
auto vec3i_x_scale(vm_
int_ t x) -> vector3i - Returns a
vector3ifor scaling along the x-axis. -
auto vec3i_y_scale(vm_
int_ t y) -> vector3i - Returns a
vector3ifor scaling along the y-axis. -
auto vec3i_z_scale(vm_
int_ t z) -> vector3i - Returns a
vector3ifor 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
vector3ito 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
vector3ibetween 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
vector3iin 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
vector4iwith all components set to 1. -
auto vec4i_x_axis(vm_
int_ t x) -> vector4i - Returns a
vector4ialong the x-axis. -
auto vec4i_y_axis(vm_
int_ t y) -> vector4i - Returns a
vector4ialong the y-axis. -
auto vec4i_z_axis(vm_
int_ t z) -> vector4i - Returns a
vector4ialong the z-axis. -
auto vec4i_w_axis(vm_
int_ t w) -> vector4i - Returns a
vector4ialong the w-axis. -
auto vec4i_x_scale(vm_
int_ t x) -> vector4i - Returns a
vector4ifor scaling along the x-axis. -
auto vec4i_y_scale(vm_
int_ t y) -> vector4i - Returns a
vector4ifor scaling along the y-axis. -
auto vec4i_z_scale(vm_
int_ t z) -> vector4i - Returns a
vector4ifor scaling along the z-axis. -
auto vec4i_w_scale(vm_
int_ t w) -> vector4i - Returns a
vector4ifor scaling along the w-axis. - auto vec4i_normalize(vector4i v) -> vector4i
- Normalizes a
vector4ito 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
vector4ito avector3i(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
vector4ito avector3iby 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
vector3iby an integer scalar. -
void vec3i_div_scalar_ptr(vector3i* res,
const vector3i* v,
vm_
int_ t s) - Scales a
vector3iby 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
vector3ito 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
vector3ibetween 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
vector4iand 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
vector4iand stores the result in res. -
void vec4i_mul_scalar_ptr(vector4i* res,
const vector4i* v,
vm_
int_ t s) - Multiplies the components of a
vector4iby 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
vector4iby 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
vector4iand stores the result in res. - void vec4i_neg_ptr(vector4i* res, const vector4i* v)
- Negates the components of a
vector4iand stores the result in res. - void vec4i_abs_ptr(vector4i* res, const vector4i* v)
- Computes the absolute value of each component of a
vector4iand stores the result in res. - void vec4i_normalize_ptr(vector4i* res, const vector4i* v)
- Normalizes a
vector4iby 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
vector4iand stores the result in res. - void vec4i_max_ptr(vector4i* res, const vector4i* a, const vector4i* b)
- Computes the component-wise maximum of two
vector4iand 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
vector4iand 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
vector4iusing 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
vector4ito 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
vector4iand stores the result in avector3i. - auto vec2_from(const vector2i* v) -> vector2
- Converts a
vector2ito avector2. - auto vec2i_from(const vector2* v) -> vector2i
- Converts a
vector2to avector2iby truncation. - auto vec2i_from_floored(const vector2* v) -> vector2i
- Converts a
vector2to avector2iby flooring each component. - auto vec2i_from_rounded(const vector2* v) -> vector2i
- Converts a
vector2to avector2iby 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
vector3to avector3iby truncation. - auto vec3i_from_floored(const vector3* v) -> vector3i
- Converts a
vector3to avector3iby flooring each component. - auto vec3i_from_rounded(const vector3* v) -> vector3i
- Converts a
vector3to avector3iby 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
vector3from 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
vector2ifrom 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
vector3ifrom 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_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_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_floor(vector2 v)
Applies floor to each component.
| Parameters | |
|---|---|
| v | The input vector. |
| Returns | The floored 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_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_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_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_floor(vector3 v)
Applies the floor per component to a vector3.
| Parameters | |
|---|---|
| v | The vector. |
| Returns | The floored 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_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_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_
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. |
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_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_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_floor(vector4 v)
Applies the floor per component to a vector4.
| Parameters | |
|---|---|
| v | The vector. |
| Returns | The floored vector. |
vector4 vec4_round(vector4 v)
Applies round per component to a vector4.
| Parameters | |
|---|---|
| v | The vector. |
| Returns | The rounded 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_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. |
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. |
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_zero(void)
Returns a vector2i with both components set to 0.
| Returns | The zero 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_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_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_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. |
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_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_ 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_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_zero(void)
Returns a zero-initialized vector3i.
| Returns | A vector3i with all components set to 0. |
|---|
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_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_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_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. |
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_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_ 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_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_zero(void)
Returns a zero-initialized vector4i.
| Returns | A vector4i with all components set to 0. |
|---|
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_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_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_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. |
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_ 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_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_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_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_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_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. |
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. |
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. |
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_.
| 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_.
| 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_.
| Parameters | |
|---|---|
| a | First vector. |
| b | Second vector. |
| Returns | True if a and b are approximately equal. |
static vm_ float_ t vec2_dot_ptr(const vector2* a,
const vector2* b)
Pointer adapter for vec2_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| Parameters | |
|---|---|
| a | Must not be NULL. |
| b | Must not be NULL. |
| eps | Passed through to vec2_ |
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| Parameters | |
|---|---|
| a | Must not be NULL. |
| b | Must not be NULL. |
| eps | Passed through to vec3_ |
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| Parameters | |
|---|---|
| a | Must not be NULL. |
| b | Must not be NULL. |
| eps | Passed through to vec4_ |
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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_
| 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.