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