diff --git a/beevee/src/aabb/bounded.rs b/beevee/src/aabb/bounded.rs index f61112c..bd8a6ad 100644 --- a/beevee/src/aabb/bounded.rs +++ b/beevee/src/aabb/bounded.rs @@ -9,6 +9,8 @@ pub trait Bounded { /// /// [`AABB`]: struct.AABB.html fn aabb(&self) -> AABB; + /// Return the centroid of self. + fn centroid(&self) -> Point; } /// Implementation of [`Bounded`] for [`AABB`] @@ -30,6 +32,10 @@ impl Bounded for AABB { fn aabb(&self) -> AABB { *self } + + fn centroid(&self) -> Point { + self.centroid() + } } /// Implementation of [`Bounded`] for [`Point`] @@ -50,4 +56,8 @@ impl Bounded for Point { fn aabb(&self) -> AABB { AABB::with_bounds(*self, *self) } + + fn centroid(&self) -> Point { + *self + } }