normalize

Function normalize 

Source
pub fn normalize(v: V3, min_len: f64) -> Option<V3>
Expand description

v / |v|, or None when the length is not finite or is <= min_len.

The threshold is the caller’s: pass 0.0 to refuse only a zero (or non-finite) vector, or a scale-appropriate epsilon. A NaN component gives a NaN length and so None. Each caller’s degenerate fallback (zero vector, +Z, the input itself) is an explicit .unwrap_or(..) at the call site. Divides each component (not a reciprocal multiply), as every site does.