Skip to main content

intersect_aabb2_aabb2

Function intersect_aabb2_aabb2 

Source
pub fn intersect_aabb2_aabb2<S>(a: Aabb2<S>, b: Aabb2<S>) -> Option<Aabb2<S>>
where S: Copy + PartialOrd + Debug,
Expand description

Boolean intersection computation of 2D axis-aligned bounding boxes.

AABBs that are merely touching return no intersection:

let a = Aabb2::with_minmax ([ 0.0, 0.0].into(), [1.0, 1.0].into()).unwrap();
let b = Aabb2::with_minmax ([-1.0, 0.0].into(), [0.0, 1.0].into()).unwrap();
assert!(intersect_aabb2_aabb2 (a, b).is_none());