bvh2d/
lib.rs

1use aabb::AABB;
2
3pub const EPSILON: f32 = 0.00001;
4
5pub type Point2 = glam::Vec2;
6
7pub type Vector2 = glam::Vec2;
8
9pub mod aabb;
10pub mod axis;
11pub mod bvh2d;
12mod utils;
13
14trait ContainedBy {
15    fn contained_by(&self, aabb: &AABB) -> bool;
16}
17
18impl ContainedBy for Point2 {
19    #[inline]
20    fn contained_by(&self, aabb: &AABB) -> bool {
21        (aabb.min.x..=aabb.max.x).contains(&self.x) && (aabb.min.y..=aabb.max.y).contains(&self.y)
22    }
23}