Skip to main content

Module vec3

Module vec3 

Source
Expand description

3-D vector helpers.

Functions§

add
a + b.
cross
a × b.
distance
Euclidean distance |a - b|.
dot
a · b.
from_xy
Lift a 2-D vector into 3-D with the given Z component.
lerp
Linear interpolation a + t * (b - a).
norm
|a|.
norm_squared
|a|².
normalize
Unit vector or [0, 0, 0] if |a| is below machine epsilon.
scale
a * s.
sub
a - b.
xy
Project v onto the horizontal XY plane (drop Z).

Type Aliases§

Vec3
3-D vector in metres.