pub trait CollisionDetector: Send + Sync {
// Required methods
fn check_collision(
&self,
bbox: &BoundingBox,
existing: &[BoundingBox],
) -> bool;
fn find_free_position(
&self,
bbox: &BoundingBox,
existing: &[BoundingBox],
bounds: &BoundingBox,
) -> Option<(f32, f32)>;
}Expand description
Trait for collision detection strategies
Required Methods§
Sourcefn check_collision(&self, bbox: &BoundingBox, existing: &[BoundingBox]) -> bool
fn check_collision(&self, bbox: &BoundingBox, existing: &[BoundingBox]) -> bool
Check if a bounding box collides with existing elements
Sourcefn find_free_position(
&self,
bbox: &BoundingBox,
existing: &[BoundingBox],
bounds: &BoundingBox,
) -> Option<(f32, f32)>
fn find_free_position( &self, bbox: &BoundingBox, existing: &[BoundingBox], bounds: &BoundingBox, ) -> Option<(f32, f32)>
Find a non-colliding position for a bounding box
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".