14 return (
vector4){.x = 0.0f, .y = 0.0f, .z = 0.0f, .w = 0.0f};
24 return (
vector4){.x = 1.0f, .y = 1.0f, .z = 1.0f, .w = 1.0f};
35 return (
vector4){.x = x, .y = 0.0f, .z = 0.0f, .w = 0.0f};
46 return (
vector4){.x = 0.0f, .y = y, .z = 0.0f, .w = 0.0f};
57 return (
vector4){.x = 0.0f, .y = 0.0f, .z = z, .w = 0.0f};
68 return (
vector4){.x = 0.0f, .y = 0.0f, .z = 0.0f, .w = w};
79 return (
vector4){.x = x, .y = 1.0f, .z = 1.0f, .w = 1.0f};
90 return (
vector4){.x = 1.0f, .y = y, .z = 1.0f, .w = 1.0f};
101 return (
vector4){.x = 1.0f, .y = 1.0f, .z = z, .w = 1.0f};
112 return (
vector4){.x = 1.0f, .y = 1.0f, .z = 1.0f, .w = w};
390 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z + a.
w * b.
w;
583 return (
vector4){.x = s, .y = s, .z = s, .w = s};
void vec4_to_vec3_ptr(vector3 *res, const vector4 *v)
Copies the x, y, z components from a vector4 to a vector3.
void vec4_sub_scalar_ptr(vector4 *res, const vector4 *v, vm_float_t s)
void vec4_div_ptr(vector4 *res, const vector4 *a, const vector4 *b)
void vec4_min_ptr(vector4 *res, const vector4 *a, const vector4 *b)
void vec4_floor_ptr(vector4 *res, const vector4 *v)
void vec4_sign_ptr(vector4 *res, const vector4 *v)
void vec4_lerp_ptr(vector4 *res, const vector4 *a, const vector4 *b, vm_float_t t)
void vec4_homogenize_ptr(vector4 *res, const vector4 *v)
void vec4_add_ptr(vector4 *res, const vector4 *a, const vector4 *b)
void vec4_max_ptr(vector4 *res, const vector4 *a, const vector4 *b)
void vec4_fract_ptr(vector4 *res, const vector4 *v)
void vec4_add_scalar_ptr(vector4 *res, const vector4 *v, vm_float_t s)
void vec4_abs_ptr(vector4 *res, const vector4 *v)
void vec4_saturate_ptr(vector4 *res, const vector4 *v)
void vec4_div_scalar_ptr(vector4 *res, const vector4 *v, vm_float_t s)
void vec4_mul_scalar_ptr(vector4 *res, const vector4 *v, vm_float_t s)
void vec4_clamp_scalar_ptr(vector4 *res, const vector4 *v, vm_float_t min, vm_float_t max)
void vec4_project_ptr(vector4 *res, const vector4 *a, const vector4 *b)
Projects a onto b.
void vec4_ceil_ptr(vector4 *res, const vector4 *v)
void vec4_reject_ptr(vector4 *res, const vector4 *a, const vector4 *b)
Returns the component of a orthogonal to b.
void vec4_round_ptr(vector4 *res, const vector4 *v)
void vec4_neg_ptr(vector4 *res, const vector4 *v)
void vec4_normalize_ptr(vector4 *res, const vector4 *v)
void vec4_slide_ptr(vector4 *res, const vector4 *v, const vector4 *normal)
Removes the component of v along normal.
void vec4_mul_ptr(vector4 *res, const vector4 *a, const vector4 *b)
void vec4_sub_ptr(vector4 *res, const vector4 *a, const vector4 *b)
void vec4_clamp_ptr(vector4 *res, const vector4 *v, const vector4 *min, const vector4 *max)
vector4 vec4_add_scalar(const vector4 v, const vm_float_t s)
Adds a scalar to each component.
vector4 vec4_saturate(const vector4 v)
Clamps each component to the range [0, 1].
vector3 vec4_to_vec3(const vector4 v)
Converts a vector4 to a vector3 (discards the w component).
vector4 vec4_slide(const vector4 v, const vector4 normal)
Removes the component of v along normal.
vector4 vec4_lerp(const vector4 a, const vector4 b, const vm_float_t t)
Linearly interpolates between two vector4.
vector4 vec4_neg(const vector4 v)
Negation of a vector.
vector4 vec4_abs(const vector4 v)
Computes the absolute value per component of a vector4.
vector4 vec4_one(void)
Returns a vector4 with all components set to 1.0f.
vector4 vec4_z_axis(const vm_float_t z)
Returns a vector4 along the z-axis.
vm_float_t vec4_length(const vector4 v)
Computes the length (magnitude) of a vector4.
vector4 vec4_z_scale(const vm_float_t z)
Returns a vector4for scaling along the z-axis.
vector4 vec4_zero(void)
Returns a zero-initialized vector4.
vector4 vec4_w_axis(const vm_float_t w)
Returns a vector4 along the w-axis.
vector4 vec4_x_scale(const vm_float_t x)
Returns avector4 for scaling along the x-axis.
vector4 vec4_add(const vector4 a, const vector4 b)
Component-wise addition of two vectors.
vm_float_t vec4_dot(const vector4 a, const vector4 b)
Computes the dot product of two vector4.
vector4 vec4_y_axis(const vm_float_t y)
Returns a vector4 along the y-axis.
vector4 vec4_ceil(const vector4 v)
Applies ceil per component to a vector4.
vm_float_t vec4_distance_squared(const vector4 a, const vector4 b)
Returns the squared Euclidean distance between a and b.
bool vec4_near(const vector4 a, const vector4 b, const vm_float_t eps)
Returns true if a and b are within eps of each other.
vector4 vec4_w_scale(const vm_float_t w)
Returns a vector4 for scaling along the w-axis.
vector4 vec4_max(const vector4 a, const vector4 b)
Computes the component-wise maximum of two vector4.
vector4 vec4_div_scalar(const vector4 v, const vm_float_t s)
Component-wise division of vector by scalar.
vm_float_t vec4_distance(const vector4 a, const vector4 b)
Computes the Euclidean distance between two vector4.
vector4 vec4_homogenize(const vector4 v)
Homogenizes a vector4 (divides x, y, z by w).
vector4 vec4_mul_scalar(const vector4 v, const vm_float_t s)
Component-wise multiplication of vector by scalar.
vector4 vec4_min(const vector4 a, const vector4 b)
Computes the component-wise minimum of two vector4.
vector4 vec4_splat(const vm_float_t s)
Returns a vector with every component set to s.
vector4 vec4_project(const vector4 a, const vector4 b)
Projects a onto b.
vm_float_t vec4_length_squared(const vector4 v)
Returns the squared Euclidean length.
vector4 vec4_sub(const vector4 a, const vector4 b)
Component-wise subtraction of two vectors.
bool vec4_is_normalized(const vector4 v)
Returns true if the vector has unit length.
vector4 vec4_x_axis(const vm_float_t x)
Returns a vector4 along the x-axis.
vector4 vec4_clamp_scalar(const vector4 v, const vm_float_t min, const vm_float_t max)
Clamps each component to the scalar range [min, max].
vector4 vec4_normalize(const vector4 v)
Normalizes a vector4 to unit length.
vector4 vec4_floor(const vector4 v)
Applies the floor per component to a vector4.
vector4 vec4_round(const vector4 v)
Applies round per component to a vector4.
vector4 vec4_fract(const vector4 v)
Returns the fractional part of each component.
bool vec4_is_zero(const vector4 v)
Returns true if every component is zero.
vector4 vec4_div(const vector4 a, const vector4 b)
Divides two vectors component-wise.
vector4 vec4_sign(const vector4 v)
Computes the sign per component of a vector4 (-1, 0, or 1).
vector4 vec4_clamp(const vector4 v, const vector4 min, const vector4 max)
Clamps a vector4 between min and max per component.
vector4 vec4_reject(const vector4 a, const vector4 b)
Returns the component of a orthogonal to b.
vector4 vec4_y_scale(const vm_float_t y)
Returns a vector4 for scaling along the y-axis.
vector4 vec4_sub_scalar(const vector4 v, const vm_float_t s)
Subtracts a scalar from each component.
vector4 vec4_mul(const vector4 a, const vector4 b)
Component-wise multiplication of two vectors.