pub trait BoundingVolume: Sized {
type Translation: Clone + Copy + PartialEq;
type Rotation: Clone + Copy + PartialEq;
type HalfSize;
fn center(&self) -> Self::Translation;
fn half_size(&self) -> Self::HalfSize;
fn visible_area(&self) -> f32;
fn contains(&self, other: &Self) -> bool;
fn merge(&self, other: &Self) -> Self;
fn grow(&self, amount: impl Into<Self::HalfSize>) -> Self;
fn shrink(&self, amount: impl Into<Self::HalfSize>) -> Self;
fn scale_around_center(&self, scale: impl Into<Self::HalfSize>) -> Self;
fn transformed_by(
mut self,
translation: impl Into<Self::Translation>,
rotation: impl Into<Self::Rotation>,
) -> Self {
self.transform_by(translation, rotation);
self
}
fn transform_by(
&mut self,
translation: impl Into<Self::Translation>,
rotation: impl Into<Self::Rotation>,
) {
self.rotate_by(rotation);
self.translate_by(translation);
}
fn translated_by(mut self, translation: impl Into<Self::Translation>) -> Self {
self.translate_by(translation);
self
}
fn translate_by(&mut self, translation: impl Into<Self::Translation>);
fn rotated_by(mut self, rotation: impl Into<Self::Rotation>) -> Self {
self.rotate_by(rotation);
self
}
fn rotate_by(&mut self, rotation: impl Into<Self::Rotation>);
}
pub trait IntersectsVolume<Volume: BoundingVolume> {
fn intersects(&self, volume: &Volume) -> bool;
}
mod bounded2d;
pub use bounded2d::*;
mod bounded3d;
pub use bounded3d::*;
mod raycast2d;
pub use raycast2d::*;
mod raycast3d;
pub use raycast3d::*;