Vecmat 0.2.3
C math and linear algebra library for 2D/3D graphics, physics, and science.
Loading...
Searching...
No Matches
vector3.c File Reference
#include <vecmat.h>

Go to the source code of this file.

Functions

vector3 vec3_zero (void)
 Returns a zero-initialized vector3.
vector3 vec3_one (void)
 Returns a vector3 with all components set to 1.0f.
vector3 vec3_x_axis (const vm_float_t x)
 Returns a vector3 along the x-axis.
vector3 vec3_y_axis (const vm_float_t y)
 Returns a vector3 along the y-axis.
vector3 vec3_z_axis (const vm_float_t z)
 Returns a vector3 along the z-axis.
vector3 vec3_x_scale (const vm_float_t x)
 Returns a vector3 for scaling along the x-axis.
vector3 vec3_y_scale (const vm_float_t y)
 Returns a vector3 for scaling along the y-axis.
vector3 vec3_z_scale (const vm_float_t z)
 Returns a vector3 for scaling along the z-axis.
vector3 vec3_add (const vector3 a, const vector3 b)
 Component-wise addition of two vectors.
vector3 vec3_sub (const vector3 a, const vector3 b)
 Component-wise subtraction of two vectors.
vector3 vec3_mul_scalar (const vector3 v, const vm_float_t s)
 Component-wise multiplication of vector by scalar.
vector3 vec3_div_scalar (const vector3 v, const vm_float_t s)
 Component-wise division of vector by scalar.
vector3 vec3_mul (const vector3 a, const vector3 b)
 Component-wise multiplication of two vectors.
vector3 vec3_neg (const vector3 v)
 Negation of a vector.
vector3 vec3_abs (const vector3 v)
 Computes the absolute value per component of a vector3.
vector3 vec3_cross (const vector3 a, const vector3 b)
 Computes the cross-product of two vector3.
vector3 vec3_normalize (const vector3 v)
 Normalizes a vector3 to unit length.
vector3 vec3_min (const vector3 a, const vector3 b)
 Computes the component-wise minimum of two vector3.
vector3 vec3_max (const vector3 a, const vector3 b)
 Computes the component-wise maximum of two vector3.
vector3 vec3_sign (const vector3 v)
 Computes the sign per component of a vector3 (-1, 0, or 1).
vector3 vec3_floor (const vector3 v)
 Applies the floor per component to a vector3.
vector3 vec3_ceil (const vector3 v)
 Applies ceil per component to a vector3.
vector3 vec3_round (const vector3 v)
 Applies round per component to a vector3.
vector3 vec3_reflect (const vector3 incident, const vector3 normal)
 Reflects an incident vector over normal.
vector3 vec3_refract (const vector3 incident, const vector3 normal, const vm_float_t eta)
 Refracts an incident vector across an interface with a given normal and ratio of refraction eta.
vector3 vec3_lerp (const vector3 a, const vector3 b, const vm_float_t t)
 Linearly interpolates between two vector3.
vector3 vec3_clamp (const vector3 v, const vector3 min, const vector3 max)
 Clamps a vector3 between min and max per component.
vm_float_t vec3_distance (const vector3 a, const vector3 b)
 Computes the Euclidean distance between two vector3.
vm_float_t vec3_angle (const vector3 a, const vector3 b)
 Computes the angle between two non-zero vector3 in radians.
vm_float_t vec3_dot (const vector3 a, const vector3 b)
 Computes the dot product of two vector3.
vm_float_t vec3_length (const vector3 v)
 Computes the length (magnitude) of a vector3.
vector3 vec3_scale (const vector3 v, const vm_float_t s)
 Scales the vector by a scalar.
vector3 vec3_div (const vector3 a, const vector3 b)
 Divides two vectors component-wise.
vector3 vec3_add_scalar (const vector3 v, const vm_float_t s)
 Adds a scalar to each component.
vector3 vec3_sub_scalar (const vector3 v, const vm_float_t s)
 Subtracts a scalar from each component.
vector3 vec3_clamp_scalar (const vector3 v, const vm_float_t min, const vm_float_t max)
 Clamps each component to the scalar range [min, max].
vector3 vec3_saturate (const vector3 v)
 Clamps each component to the range [0, 1].
vector3 vec3_fract (const vector3 v)
 Returns the fractional part of each component.
vector3 vec3_project (const vector3 a, const vector3 b)
 Projects a onto b.
vector3 vec3_slide (const vector3 v, const vector3 normal)
 Removes the component of v along normal.
vector3 vec3_reject (const vector3 a, const vector3 b)
 Returns the component of a orthogonal to b.
vector3 vec3_rotate_axis (const vector3 v, const vector3 axis, const vm_float_t angle)
 Rotates v around axis by angle radians.
vector3 vec3_splat (const vm_float_t s)
 Returns a vector with every component set to s.
vector3 vec3_from_vec2 (const vector2 v, const vm_float_t z)
 Builds a vector3 from a vector2 and z.
vector3 vec3_move_toward (const vector3 current, const vector3 target, const vm_float_t max_delta)
 Moves current toward target by at most max_delta.
vector3 vec3_limit_length (const vector3 v, const vm_float_t max_len)
 Clamps the vector length to max_len.
vector2 vec3_xy (const vector3 v)
 Returns the x and y components as a 2D vector.
void vec3_orthonormal_basis (const vector3 n, vector3 *t, vector3 *b)
 Builds a tangent and bitangent orthonormal to n.
vm_float_t vec3_length_squared (const vector3 v)
 Returns the squared Euclidean length.
vm_float_t vec3_length_manhattan (const vector3 v)
 Returns the Manhattan (L1) length.
vm_float_t vec3_length_chebyshev (const vector3 v)
 Returns the Chebyshev (L-inf) length.
vm_float_t vec3_distance_squared (const vector3 a, const vector3 b)
 Returns the squared Euclidean distance between a and b.
vm_float_t vec3_signed_angle (const vector3 a, const vector3 b, const vector3 axis)
 Returns the signed angle from a to b around axis.
vm_float_t vec3_min_component (const vector3 v)
 Returns the smallest component.
vm_float_t vec3_max_component (const vector3 v)
 Returns the largest component.
vm_float_t vec3_sum (const vector3 v)
 Returns the sum of all components.
bool vec3_is_zero (const vector3 v)
 Returns true if every component is zero.
bool vec3_is_normalized (const vector3 v)
 Returns true if the vector has unit length.
bool vec3_near (const vector3 a, const vector3 b, const vm_float_t eps)
 Returns true if a and b are within eps of each other.

Function Documentation

◆ vec3_abs()

vector3 vec3_abs ( const vector3 v)

Computes the absolute value per component of a vector3.

See vec3_abs_ptr for the out-parameter version.

Parameters
vThe vector.
Returns
The absolute vector3.

Definition at line 196 of file vector3.c.

References vec3_abs_ptr().

◆ vec3_add()

vector3 vec3_add ( const vector3 a,
const vector3 b )

Component-wise addition of two vectors.

See vec3_add_ptr for the out-parameter version.

Parameters
aFirst vector.
bSecond vector.
Returns
Result vector.

Definition at line 102 of file vector3.c.

References vec3_add_ptr().

◆ vec3_add_scalar()

vector3 vec3_add_scalar ( const vector3 v,
const vm_float_t s )

Adds a scalar to each component.

See vec3_add_scalar_ptr instead.

Parameters
vInput vector.
sScalar value.
Returns
The resulting vector3.

Definition at line 485 of file vector3.c.

References vec3_add_scalar_ptr().

◆ vec3_angle()

vm_float_t vec3_angle ( const vector3 a,
const vector3 b )

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

Parameters
aFirst vector.
bSecond vector.
Returns
The angle between the directions of a and b.

Definition at line 413 of file vector3.c.

References vec3_dot(), vec3_length(), and VECMAT_ACOS.

◆ vec3_ceil()

vector3 vec3_ceil ( const vector3 v)

Applies ceil per component to a vector3.

See vec3_ceil_ptr for the out-parameter version.

Parameters
vThe vector.
Returns
The ceiling vector.

Definition at line 304 of file vector3.c.

References vec3_ceil_ptr().

◆ vec3_clamp()

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

Clamps a vector3 between min and max per component.

See vec3_clamp_ptr for the out-parameter version.

Parameters
vThe vector.
minMinimum bounds.
maxMaximum bounds.
Returns
The clamped vector.

Definition at line 387 of file vector3.c.

References vec3_clamp_ptr().

◆ vec3_clamp_scalar()

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

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

See vec3_clamp_scalar_ptr instead.

Parameters
vInput vector.
minLower bound.
maxUpper bound.
Returns
The resulting vector3.

Definition at line 518 of file vector3.c.

References vec3_clamp_scalar_ptr().

◆ vec3_cross()

vector3 vec3_cross ( const vector3 a,
const vector3 b )

Computes the cross-product of two vector3.

See vec3_cross_ptr for the out-parameter version.

Parameters
aFirst vector.
bSecond vector.
Returns
The cross-product (a × b).

Definition at line 212 of file vector3.c.

References vec3_cross_ptr().

Referenced by mat4_look_at_ptr(), and vec3_signed_angle().

◆ vec3_distance()

vm_float_t vec3_distance ( const vector3 a,
const vector3 b )

Computes the Euclidean distance between two vector3.

Parameters
aFirst vector.
bSecond vector.
Returns
The distance between a and b.

Definition at line 401 of file vector3.c.

References vec3_length(), and vec3_sub().

◆ vec3_distance_squared()

vm_float_t vec3_distance_squared ( const vector3 a,
const vector3 b )

Returns the squared Euclidean distance between a and b.

Parameters
aFirst input vector.
bSecond input vector.
Returns
The resulting scalar.

Definition at line 749 of file vector3.c.

References vector3::x, vector3::y, and vector3::z.

◆ vec3_div()

vector3 vec3_div ( const vector3 a,
const vector3 b )

Divides two vectors component-wise.

See vec3_div_ptr instead.

Parameters
aFirst input vector.
bSecond input vector.
Returns
The resulting vector3.

Definition at line 469 of file vector3.c.

References vec3_div_ptr().

◆ vec3_div_scalar()

vector3 vec3_div_scalar ( const vector3 v,
const vm_float_t s )

Component-wise division of vector by scalar.

See vec3_div_scalar_ptr for the out-parameter version.

Parameters
vThe vector.
sThe scalar (non-zero).
Returns
Result vector.

Definition at line 150 of file vector3.c.

References vec3_div_scalar_ptr().

◆ vec3_dot()

vm_float_t vec3_dot ( const vector3 a,
const vector3 b )

Computes the dot product of two vector3.

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

Definition at line 428 of file vector3.c.

References vector3::x, vector3::y, and vector3::z.

Referenced by mat4_look_at_ptr(), vec3_angle(), vec3_length(), vec3_length_squared(), vec3_project_ptr(), vec3_reflect_ptr(), vec3_refract_ptr(), vec3_rotate_axis_ptr(), vec3_signed_angle(), and vec3_slide_ptr().

◆ vec3_floor()

vector3 vec3_floor ( const vector3 v)

Applies the floor per component to a vector3.

See vec3_floor_ptr for the out-parameter version.

Parameters
vThe vector.
Returns
The floored vector.

Definition at line 289 of file vector3.c.

References vec3_floor_ptr().

◆ vec3_fract()

vector3 vec3_fract ( const vector3 v)

Returns the fractional part of each component.

See vec3_fract_ptr instead.

Parameters
vInput vector.
Returns
The resulting vector3.

Definition at line 548 of file vector3.c.

References vec3_fract_ptr().

◆ vec3_from_vec2()

vector3 vec3_from_vec2 ( const vector2 v,
const vm_float_t z )

Builds a vector3 from a vector2 and z.

See vec3_from_vec2_ptr instead.

Parameters
vInput vector.
zZ component.
Returns
The resulting vector3.

Definition at line 642 of file vector3.c.

References vec3_from_vec2_ptr().

◆ vec3_is_normalized()

bool vec3_is_normalized ( const vector3 v)

Returns true if the vector has unit length.

Parameters
vInput vector.
Returns
True if the vector has unit length.

Definition at line 823 of file vector3.c.

References vec3_length_squared(), VECMAT_EPSILON, and VECMAT_FABS.

◆ vec3_is_zero()

bool vec3_is_zero ( const vector3 v)

Returns true if every component is zero.

Parameters
vInput vector.
Returns
True if every component is zero.

Definition at line 810 of file vector3.c.

References VECMAT_EPSILON, VECMAT_FABS, vector3::x, vector3::y, and vector3::z.

◆ vec3_length()

vm_float_t vec3_length ( const vector3 v)

Computes the length (magnitude) of a vector3.

Parameters
vThe vector.
Returns
The Euclidean length of v.

Definition at line 439 of file vector3.c.

References vec3_dot(), and VECMAT_SQRT.

Referenced by vec3_angle(), vec3_distance(), vec3_limit_length_ptr(), and vec3_normalize_ptr().

◆ vec3_length_chebyshev()

vm_float_t vec3_length_chebyshev ( const vector3 v)

Returns the Chebyshev (L-inf) length.

Parameters
vInput vector.
Returns
The resulting scalar.

Definition at line 737 of file vector3.c.

References VECMAT_FABS, VECMAT_FMAX, vector3::x, vector3::y, and vector3::z.

◆ vec3_length_manhattan()

vm_float_t vec3_length_manhattan ( const vector3 v)

Returns the Manhattan (L1) length.

Parameters
vInput vector.
Returns
The resulting scalar.

Definition at line 726 of file vector3.c.

References VECMAT_FABS, vector3::x, vector3::y, and vector3::z.

◆ vec3_length_squared()

vm_float_t vec3_length_squared ( const vector3 v)

Returns the squared Euclidean length.

Parameters
vInput vector.
Returns
The resulting scalar.

Definition at line 715 of file vector3.c.

References vec3_dot().

Referenced by vec3_is_normalized().

◆ vec3_lerp()

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

Linearly interpolates between two vector3.

See vec3_lerp_ptr for the out-parameter version.

Parameters
aStart vector.
bEnd vector.
tInterpolation factor [0, 1].
Returns
The interpolated vector (a * (1 - t) + b * t).

Definition at line 370 of file vector3.c.

References vec3_lerp_ptr().

◆ vec3_limit_length()

vector3 vec3_limit_length ( const vector3 v,
const vm_float_t max_len )

Clamps the vector length to max_len.

See vec3_limit_length_ptr instead.

Parameters
vInput vector.
max_lenMaximum length.
Returns
The resulting vector3.

Definition at line 675 of file vector3.c.

References vec3_limit_length_ptr().

◆ vec3_max()

vector3 vec3_max ( const vector3 a,
const vector3 b )

Computes the component-wise maximum of two vector3.

See vec3_max_ptr for the out-parameter version.

Parameters
aFirst vector.
bSecond vector.
Returns
Per-component max(a, b).

Definition at line 259 of file vector3.c.

References vec3_max_ptr().

◆ vec3_max_component()

vm_float_t vec3_max_component ( const vector3 v)

Returns the largest component.

Parameters
vInput vector.
Returns
The resulting scalar.

Definition at line 788 of file vector3.c.

References VECMAT_FMAX, vector3::x, vector3::y, and vector3::z.

◆ vec3_min()

vector3 vec3_min ( const vector3 a,
const vector3 b )

Computes the component-wise minimum of two vector3.

See vec3_min_ptr for the out-parameter version.

Parameters
aFirst vector.
bSecond vector.
Returns
Per-component min(a, b).

Definition at line 243 of file vector3.c.

References vec3_min_ptr().

◆ vec3_min_component()

vm_float_t vec3_min_component ( const vector3 v)

Returns the smallest component.

Parameters
vInput vector.
Returns
The resulting scalar.

Definition at line 777 of file vector3.c.

References VECMAT_FMIN, vector3::x, vector3::y, and vector3::z.

◆ vec3_move_toward()

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

Moves current toward target by at most max_delta.

See vec3_move_toward_ptr instead.

Parameters
currentCurrent position.
targetTarget position.
max_deltaMaximum distance to move.
Returns
The resulting vector3.

Definition at line 659 of file vector3.c.

References vec3_move_toward_ptr().

◆ vec3_mul()

vector3 vec3_mul ( const vector3 a,
const vector3 b )

Component-wise multiplication of two vectors.

See vec3_mul_ptr for the out-parameter version.

Parameters
aFirst vector.
bSecond vector.
Returns
Result vector.

Definition at line 166 of file vector3.c.

References vec3_mul_ptr().

◆ vec3_mul_scalar()

vector3 vec3_mul_scalar ( const vector3 v,
const vm_float_t s )

Component-wise multiplication of vector by scalar.

See vec3_mul_scalar_ptr for the out-parameter version.

Parameters
vThe vector.
sThe scalar.
Returns
Result vector.

Definition at line 134 of file vector3.c.

References vec3_mul_scalar_ptr().

◆ vec3_near()

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

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

Parameters
aFirst input vector.
bSecond input vector.
epsDistance tolerance.
Returns
True if a and b are within eps.

Definition at line 836 of file vector3.c.

References VECMAT_FABS, vector3::x, vector3::y, and vector3::z.

◆ vec3_neg()

vector3 vec3_neg ( const vector3 v)

Negation of a vector.

See vec3_neg_ptr for the out-parameter version.

Parameters
vThe vector.
Returns
The negated vector.

Definition at line 181 of file vector3.c.

References vec3_neg_ptr().

◆ vec3_normalize()

vector3 vec3_normalize ( const vector3 v)

Normalizes a vector3 to unit length.

See vec3_normalize_ptr for the out-parameter version.

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

Definition at line 227 of file vector3.c.

References vec3_normalize_ptr().

Referenced by mat4_look_at_ptr(), mat4_rotation_ptr(), and quat_from_axis_angle_ptr().

◆ vec3_one()

vector3 vec3_one ( void )

Returns a vector3 with all components set to 1.0f.

Returns
A vector3 with all components set to 1.0f.

Definition at line 22 of file vector3.c.

◆ vec3_orthonormal_basis()

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

Builds a tangent and bitangent orthonormal to n.

Parameters
nUnit normal.
tOutput tangent.
bOutput bitangent.

Definition at line 704 of file vector3.c.

References vec3_orthonormal_basis_ptr().

◆ vec3_project()

vector3 vec3_project ( const vector3 a,
const vector3 b )

Projects a onto b.

See vec3_project_ptr instead.

Parameters
aFirst input vector.
bSecond input vector.
Returns
The resulting vector3.

Definition at line 564 of file vector3.c.

References vec3_project_ptr().

◆ vec3_reflect()

vector3 vec3_reflect ( const vector3 incident,
const vector3 normal )

Reflects an incident vector over normal.

See vec3_reflect_ptr for the out-parameter version.

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

Definition at line 335 of file vector3.c.

References vec3_reflect_ptr().

◆ vec3_refract()

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

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

See vec3_refract_ptr for the out-parameter version.

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

Definition at line 353 of file vector3.c.

References vec3_refract_ptr().

◆ vec3_reject()

vector3 vec3_reject ( const vector3 a,
const vector3 b )

Returns the component of a orthogonal to b.

See vec3_reject_ptr instead.

Parameters
aFirst input vector.
bSecond input vector.
Returns
The resulting vector3.

Definition at line 596 of file vector3.c.

References vec3_reject_ptr().

◆ vec3_rotate_axis()

vector3 vec3_rotate_axis ( const vector3 v,
const vector3 axis,
const vm_float_t angle )

Rotates v around axis by angle radians.

See vec3_rotate_axis_ptr instead.

Parameters
vInput vector.
axisRotation axis.
angleAngle in radians.
Returns
The resulting vector3.

Definition at line 613 of file vector3.c.

References vec3_rotate_axis_ptr().

◆ vec3_round()

vector3 vec3_round ( const vector3 v)

Applies round per component to a vector3.

See vec3_round_ptr for the out-parameter version.

Parameters
vThe vector.
Returns
The rounded vector.

Definition at line 319 of file vector3.c.

References vec3_round_ptr().

◆ vec3_saturate()

vector3 vec3_saturate ( const vector3 v)

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

See vec3_saturate_ptr instead.

Parameters
vInput vector.
Returns
The resulting vector3.

Definition at line 533 of file vector3.c.

References vec3_saturate_ptr().

◆ vec3_scale()

vector3 vec3_scale ( const vector3 v,
const vm_float_t s )

Scales the vector by a scalar.

See vec3_scale_ptr instead.

Parameters
vInput vector.
sScalar value.
Returns
The resulting vector3.

Definition at line 453 of file vector3.c.

References vec3_scale_ptr().

◆ vec3_sign()

vector3 vec3_sign ( const vector3 v)

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

See vec3_sign_ptr for the out-parameter version.

Parameters
vThe vector.
Returns
The sign vector.

Definition at line 274 of file vector3.c.

References vec3_sign_ptr().

◆ vec3_signed_angle()

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

Returns the signed angle from a to b around axis.

Parameters
aFirst input vector.
bSecond input vector.
axisRotation axis.
Returns
The resulting scalar.

Definition at line 765 of file vector3.c.

References vec3_cross(), vec3_dot(), and VECMAT_ATAN2.

◆ vec3_slide()

vector3 vec3_slide ( const vector3 v,
const vector3 normal )

Removes the component of v along normal.

See vec3_slide_ptr instead.

Parameters
vInput vector.
normalSurface normal.
Returns
The resulting vector3.

Definition at line 580 of file vector3.c.

References vec3_slide_ptr().

◆ vec3_splat()

vector3 vec3_splat ( const vm_float_t s)

Returns a vector with every component set to s.

See vec3_splat_ptr instead.

Parameters
sScalar value.
Returns
The resulting vector3.

Definition at line 628 of file vector3.c.

◆ vec3_sub()

vector3 vec3_sub ( const vector3 a,
const vector3 b )

Component-wise subtraction of two vectors.

See vec3_sub_ptr for the out-parameter version.

Parameters
aFirst vector.
bSecond vector.
Returns
Result vector.

Definition at line 118 of file vector3.c.

References vec3_sub_ptr().

Referenced by mat4_look_at_ptr(), and vec3_distance().

◆ vec3_sub_scalar()

vector3 vec3_sub_scalar ( const vector3 v,
const vm_float_t s )

Subtracts a scalar from each component.

See vec3_sub_scalar_ptr instead.

Parameters
vInput vector.
sScalar value.
Returns
The resulting vector3.

Definition at line 501 of file vector3.c.

References vec3_sub_scalar_ptr().

◆ vec3_sum()

vm_float_t vec3_sum ( const vector3 v)

Returns the sum of all components.

Parameters
vInput vector.
Returns
The resulting scalar.

Definition at line 799 of file vector3.c.

References vector3::x, vector3::y, and vector3::z.

◆ vec3_x_axis()

vector3 vec3_x_axis ( const vm_float_t x)

Returns a vector3 along the x-axis.

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

Definition at line 33 of file vector3.c.

◆ vec3_x_scale()

vector3 vec3_x_scale ( const vm_float_t x)

Returns a vector3 for scaling along the x-axis.

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

Definition at line 66 of file vector3.c.

◆ vec3_xy()

vector2 vec3_xy ( const vector3 v)

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

See vec3_xy_ptr instead.

Parameters
vInput vector.
Returns
The resulting vector2.

Definition at line 690 of file vector3.c.

References vec3_xy_ptr().

◆ vec3_y_axis()

vector3 vec3_y_axis ( const vm_float_t y)

Returns a vector3 along the y-axis.

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

Definition at line 44 of file vector3.c.

◆ vec3_y_scale()

vector3 vec3_y_scale ( const vm_float_t y)

Returns a vector3 for scaling along the y-axis.

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

Definition at line 77 of file vector3.c.

◆ vec3_z_axis()

vector3 vec3_z_axis ( const vm_float_t z)

Returns a vector3 along the z-axis.

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

Definition at line 55 of file vector3.c.

◆ vec3_z_scale()

vector3 vec3_z_scale ( const vm_float_t z)

Returns a vector3 for scaling along the z-axis.

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

Definition at line 88 of file vector3.c.

◆ vec3_zero()

vector3 vec3_zero ( void )

Returns a zero-initialized vector3.

Returns
A vector3 with all components set to 0.0f.

Definition at line 12 of file vector3.c.