Module v3

Module v3 

Source
Expand description

3-vectors over [f64; 3]. Every function is FMA-free with the op order written out; see the module conventions.

Functions§

add
canonical
Flip n so its largest-magnitude component is positive, so a face and its antipodal opposite collapse onto one direction. Ties break x, y, z. A NaN component never wins a comparison, and -0.0 < 0.0 is false, so neither flips the vector.
cross
Right-handed cross product, each component x*y - z*w unfused.
dist
Distance, norm(sub(a, b)). Bit-equal to the powi(2) spelling: powi(x, 2) lowers to x * x.
dot
a0*b0 + a1*b1 + a2*b2, left to right, never fused.
norm
Euclidean length, dot(a, a).sqrt(). (Not hypot: the two differ in the last bit, and every site on main uses this spelling.)
normalize
v / |v|, or None when the length is not finite or is <= min_len.
scale
sub
tri_normal
The unnormalised triangle normal cross(b - a, c - a); its length is twice the triangle’s area.

Type Aliases§

V3
A 3-vector.