Add a method to fetch the center of a rect
This commit is contained in:
parent
dcd12279d4
commit
df150dea8a
|
@ -155,6 +155,11 @@ impl RectF {
|
||||||
self.0[3]
|
self.0[3]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn center(self) -> Vector2F {
|
||||||
|
self.origin() + self.size().scale(0.5)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn scale(self, factor: f32) -> RectF {
|
pub fn scale(self, factor: f32) -> RectF {
|
||||||
RectF(self.0 * F32x4::splat(factor))
|
RectF(self.0 * F32x4::splat(factor))
|
||||||
|
|
Loading…
Reference in New Issue