Compare commits
4 Commits
md-generic
...
test-fail
| Author | SHA1 | Date | |
|---|---|---|---|
|
ddfeca41e9
|
|||
|
8f580ad6ba
|
|||
|
68e81b31ba
|
|||
|
cbd6e1a608
|
@@ -843,4 +843,33 @@ fn minimum_difference<const ENABLE_FAST_FAIL:bool,T,M:MeshQuery>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: unit tests
|
#[cfg(test)]
|
||||||
|
mod test{
|
||||||
|
use super::*;
|
||||||
|
use crate::model::{PhysicsMesh,PhysicsMeshView};
|
||||||
|
|
||||||
|
fn mesh_contains_point(mesh:PhysicsMeshView<'_>,point:Planar64Vec3)->bool{
|
||||||
|
const ENABLE_FAST_FAIL:bool=true;
|
||||||
|
// TODO: remove mesh negation
|
||||||
|
minimum_difference::<ENABLE_FAST_FAIL,_,_>(&mesh,point,
|
||||||
|
// on_exact
|
||||||
|
|is_intersecting,_simplex|{
|
||||||
|
is_intersecting
|
||||||
|
},
|
||||||
|
// on_escape
|
||||||
|
|_simplex|{
|
||||||
|
// intersection is guaranteed at this point
|
||||||
|
true
|
||||||
|
},
|
||||||
|
// fast_fail value
|
||||||
|
||false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_cube_points(){
|
||||||
|
let mesh=PhysicsMesh::unit_cube();
|
||||||
|
let mesh_view=mesh.complete_mesh_view();
|
||||||
|
assert!(mesh_contains_point(mesh_view,vec3::NEG_Z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user