parry3d_f64/query/intersection_test/intersection_test_halfspace_support_map.rs
1use crate::math::Pose;
2use crate::shape::HalfSpace;
3use crate::shape::SupportMap;
4
5/// Intersection test between a halfspace and a support-mapped shape (Cuboid, ConvexHull, etc.)
6pub fn intersection_test_halfspace_support_map<G: ?Sized + SupportMap>(
7 pos12: &Pose,
8 halfspace: &HalfSpace,
9 other: &G,
10) -> bool {
11 let deepest = other.support_point_toward(pos12, -halfspace.normal);
12 halfspace.normal.dot(deepest) <= 0.0
13}
14
15/// Intersection test between a support-mapped shape (Cuboid, ConvexHull, etc.) and a halfspace.
16pub fn intersection_test_support_map_halfspace<G: ?Sized + SupportMap>(
17 pos12: &Pose,
18 other: &G,
19 halfspace: &HalfSpace,
20) -> bool {
21 intersection_test_halfspace_support_map(&pos12.inverse(), halfspace, other)
22}