MCPcopy Create free account
hub / github.com/PerroEngine/Perro / normalize3

Function normalize3

perro_source/core/perro_builtin_meshes/src/lib.rs:538–545  ·  view source on GitHub ↗
(v: [f32; 3])

Source from the content-addressed store, hash-verified

536
537#[inline]
538fn normalize3(v: [f32; 3]) -> [f32; 3] {
539 let len_sq = dot3(v, v);
540 if len_sq > 1.0e-12 && len_sq.is_finite() {
541 scale3(v, len_sq.sqrt().recip())
542 } else {
543 [0.0, 0.0, 0.0]
544 }
545}
546
547#[cfg(test)]
548mod tests {

Callers 2

coneFunction · 0.70
push_triangleFunction · 0.70

Calls 2

scale3Function · 0.85
dot3Function · 0.70

Tested by

no test coverage detected