pub fn normalize_vec<T>(v: Vector3<T>) -> Vector3<T> where
    T: Float
Expand description

Normalization of Vector3.

If you enter a zero vector, it returns a zero vector.

Example

// This norm is not 1.
let v: Vector3<f64> = [1.0, 2.0, 3.0];
assert!( (1.0 - norm_vec(v)).abs() > 1e-12 );
 
// Now that normalized, this norm is 1!
let v_n = normalize_vec(v);
assert!( (1.0 - norm_vec(v_n)).abs() < 1e-12 );