region: add inset method
This commit is contained in:
parent
de538d528b
commit
91ecc49d68
11
region.cpp
11
region.cpp
@ -210,6 +210,17 @@ util::region<T>::intersection (const util::region<T> &rhs) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
util::region<T>
|
||||||
|
util::region<T>::inset (T mag)
|
||||||
|
{
|
||||||
|
CHECK_GE (w - x, 2 * mag);
|
||||||
|
CHECK_GE (h - y, 2 * mag);
|
||||||
|
|
||||||
|
return { x + mag, y + mag, w - 2 * mag, h - 2 * mag };
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool
|
bool
|
||||||
|
@ -62,6 +62,9 @@ namespace util {
|
|||||||
// Compute binary region combinations
|
// Compute binary region combinations
|
||||||
region intersection (const region<T>&) const;
|
region intersection (const region<T>&) const;
|
||||||
|
|
||||||
|
// Compute a region `mag` units into the region
|
||||||
|
region inset (T mag);
|
||||||
|
|
||||||
// Logical comparison operators
|
// Logical comparison operators
|
||||||
bool operator ==(const region<T>& rhs) const;
|
bool operator ==(const region<T>& rhs) const;
|
||||||
bool operator !=(const region<T>& rhs) const
|
bool operator !=(const region<T>& rhs) const
|
||||||
|
Loading…
Reference in New Issue
Block a user