word_cloud/collision/mod.rs
1//! Rectangles collision detection
2use crate::geometry::{Rectangle, Vector};
3
4mod bb_collider;
5
6pub use bb_collider::BoundingBoxCollider;
7
8/// Struct implementing this trait can detect rectangles collisions.
9pub trait CollisionStrategy {
10 /// Does the given rectangle at the given position collide with an already added rectangle?
11 fn collides(&self, pos: Vector, r: &Rectangle) -> bool;
12 /// Add the given rectangle at the given position to the list of rectangles to detect collisions with.
13 fn add(&mut self, pos: Vector, r: Rectangle);
14}