Add region::contains method

This commit is contained in:
Danny Robson 2011-10-20 21:09:47 +11:00
parent 2aee108e79
commit 0347936983
2 changed files with 12 additions and 1 deletions

View File

@ -108,6 +108,16 @@ region<T>::includes (const point &p) const {
}
template <typename T>
bool
region<T>::contains (const point& p) const {
return p.x > x &&
p.y > y &&
p.x < x + width &&
p.y < y + height;
}
template <typename T>
bool
region<T>::overlaps (const region<T> &rhs) const {

View File

@ -57,7 +57,8 @@ namespace util {
T area (void) const;
bool empty (void) const;
bool includes (const point&) const;
bool includes (const point&) const; // inclusive of borders
bool contains (const point&) const; // exclusive of borders
bool overlaps (const region<T>&) const;
bool operator ==(const region<T>& rhs) const;