Skip to main content

normalize3

Function normalize3 

Source
pub fn normalize3(v: [f32; 3]) -> [f32; 3]
Expand description

Normalise a 3-element vector to unit length.

Returns [0.0, 0.0, 0.0] when the input magnitude is less than 1e-10.

ยงExamples

use oxigdal_gpu::normalize3;

let n = normalize3([3.0, 0.0, 0.0]);
assert!((n[0] - 1.0).abs() < 1e-6);