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

Function mat4_transform_point

native/shared/src/picking.rs:278–285  ·  view source on GitHub ↗
(m: &[[f32; 4]; 4], p: &[f32; 3])

Source from the content-addressed store, hash-verified

276}
277
278fn mat4_transform_point(m: &[[f32; 4]; 4], p: &[f32; 3]) -> [f32; 3] {
279 let v = mat4_mul_vec4(m, &[p[0], p[1], p[2], 1.0]);
280 if v[3].abs() > 1e-8 {
281 [v[0]/v[3], v[1]/v[3], v[2]/v[3]]
282 } else {
283 [v[0], v[1], v[2]]
284 }
285}
286
287fn mat4_transform_dir(m: &[[f32; 4]; 4], d: &[f32; 3]) -> [f32; 3] {
288 // Transform direction (no translation, no perspective divide)

Callers 2

raycast_sceneFunction · 0.70
raycast_scene_allFunction · 0.70

Calls 1

mat4_mul_vec4Function · 0.70

Tested by

no test coverage detected