pub trait Shape {
// Required methods
fn aabb(&self) -> Rect;
fn contains(&self, point: Vec2) -> bool;
fn intersects(&self, other: &Self) -> bool;
// Provided method
fn contains_rect(&self, rect: &Rect) -> bool { ... }
}
Expand description
A trait for shapes that can be used to query the Quadtree. Shapes must be able to provide their start and end points, their center point, and check if they contain a point. They must also be able to check if they intersect with another shape.
Required Methods§
Sourcefn intersects(&self, other: &Self) -> bool
fn intersects(&self, other: &Self) -> bool
Check if the shape shares any space with another shape
Provided Methods§
Sourcefn contains_rect(&self, rect: &Rect) -> bool
fn contains_rect(&self, rect: &Rect) -> bool
Check if the shape fully contains a given rect
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.