Add includes query for region and point
This commit is contained in:
parent
d749be578a
commit
b71049df85
10
region.cpp
10
region.cpp
@ -98,6 +98,16 @@ region<T>::empty (void) const
|
||||
{ return almost_equal (area (), 0); }
|
||||
|
||||
|
||||
template <typename T>
|
||||
bool
|
||||
region<T>::includes (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 {
|
||||
|
@ -21,6 +21,8 @@
|
||||
#ifndef __UTIL_REGION_HPP
|
||||
#define __UTIL_REGION_HPP
|
||||
|
||||
#include "point.hpp"
|
||||
|
||||
namespace util {
|
||||
/**
|
||||
* A pure two-dimensional size, without positioning
|
||||
@ -54,6 +56,8 @@ namespace util {
|
||||
|
||||
T area (void) const;
|
||||
bool empty (void) const;
|
||||
|
||||
bool includes (const point&) const;
|
||||
bool overlaps (const region<T>&) const;
|
||||
|
||||
bool operator ==(const region<T>& rhs) const;
|
||||
|
Loading…
Reference in New Issue
Block a user