Skip to main content

normalize

Function normalize 

Source
pub fn normalize(v: &mut [f32]) -> f32
Expand description

Normalizes a vector to unit length (L2 norm = 1).

Returns the original magnitude. If magnitude is zero, returns 0.0 and leaves the vector unchanged.