Rect: add center point getter
This commit is contained in:
parent
3bcec77482
commit
de776a4065
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue