MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / normalise

Function normalise

native/shared/src/renderer/planar_reflection.rs:275–283  ·  view source on GitHub ↗
(v: [f32; 3])

Source from the content-addressed store, hash-verified

273}
274
275fn normalise(v: [f32; 3]) -> [f32; 3] {
276 let len_sq = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
277 if len_sq < 1e-10 {
278 // Default to +Y — a horizontal mirror like a calm lake.
279 return [0.0, 1.0, 0.0];
280 }
281 let inv = 1.0 / len_sq.sqrt();
282 [v[0] * inv, v[1] * inv, v[2] * inv]
283}
284
285// =====================================================================
286// Tests

Callers 3

newMethod · 0.85
reflection_matrixFunction · 0.85
mirrored_camera_posFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected