parry2d/query/intersection_test/
intersection_test_cuboid_cuboid.rs1use crate::math::Pose;
2use crate::query::sat;
3use crate::shape::Cuboid;
4
5#[inline]
7pub fn intersection_test_cuboid_cuboid(pos12: &Pose, cuboid1: &Cuboid, cuboid2: &Cuboid) -> bool {
8 let sep1 = sat::cuboid_cuboid_find_local_separating_normal_oneway(cuboid1, cuboid2, pos12).0;
9
10 if sep1 > 0.0 {
11 return false;
12 }
13
14 let pos21 = pos12.inverse();
15 let sep2 = sat::cuboid_cuboid_find_local_separating_normal_oneway(cuboid2, cuboid1, &pos21).0;
16 if sep2 > 0.0 {
17 return false;
18 }
19
20 #[cfg(feature = "dim2")]
21 return true; #[cfg(feature = "dim3")]
23 {
24 let sep3 = sat::cuboid_cuboid_find_local_separating_edge_twoway(cuboid1, cuboid2, pos12).0;
25 sep3 <= 0.0
26 }
27}