Add overlaps query for regions
This commit is contained in:
parent
ed33f3ebce
commit
e8c9e1a11f
@ -98,6 +98,15 @@ region<T>::empty (void) const
|
||||
{ return almost_equal (area (), 0); }
|
||||
|
||||
|
||||
template <typename T>
|
||||
bool
|
||||
region<T>::overlaps (const region<T> &rhs) const {
|
||||
return x < rhs.x + rhs.width &&
|
||||
x + width > rhs.x &&
|
||||
y < rhs.y + rhs.height &&
|
||||
y + height > rhs.y;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool
|
||||
region<T>::operator ==(const region& rhs) const
|
||||
|
@ -54,6 +54,7 @@ namespace util {
|
||||
|
||||
T area (void) const;
|
||||
bool empty (void) const;
|
||||
bool overlaps (const region<T>&) const;
|
||||
|
||||
bool operator ==(const region<T>& rhs) const;
|
||||
bool operator !=(const region<T>& rhs) const
|
||||
|
Loading…
Reference in New Issue
Block a user