diff --git a/geometry/src/rect.rs b/geometry/src/rect.rs index 50ff99eb..3c254d65 100644 --- a/geometry/src/rect.rs +++ b/geometry/src/rect.rs @@ -155,6 +155,11 @@ impl RectF { self.0[3] } + #[inline] + pub fn center(self) -> Vector2F { + self.origin() + self.size().scale(0.5) + } + #[inline] pub fn scale(self, factor: f32) -> RectF { RectF(self.0 * F32x4::splat(factor))