Add a method to fetch the center of a rect
@@ -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))
