normalize_3d

Function normalize_3d 

Source
pub fn normalize_3d(v: [f64; 3]) -> [f64; 3]
Expand description

Normalize a 3D vector

§Arguments

  • v - Vector to normalize [x, y, z]

§Returns

  • Normalized vector, or zero vector if input has zero magnitude

§Examples

use scirs2_spatial::convex_hull::geometry::calculations_3d::normalize_3d;

let v = [3.0, 4.0, 0.0];
let normalized = normalize_3d(v);
assert_eq!(normalized, [0.6, 0.8, 0.0]);