Rect: add center point getter

This commit is contained in:
Charles Dang 2024-09-02 18:46:16 -04:00
parent 3bcec77482
commit de776a4065

View file

@ -100,6 +100,12 @@ public:
/** The area of this rectangle, in square pixels. */
constexpr int area() const { return w * h; }
/** The center point of the rectangle, accounting for origin. */
constexpr point center() const
{
return {(x + w) / 2, (y + h) / 2};
}
/** False if both w and h are > 0, true otherwise. */
bool empty() const;