region: add vector addition operator
This commit is contained in:
parent
4057a131c8
commit
ba878238af
12
region.cpp
12
region.cpp
@ -297,7 +297,17 @@ util::region<T>::expanded (T mag) const
|
|||||||
return expanded (mag, mag);
|
return expanded (mag, mag);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
template <typename T>
|
||||||
|
util::region<T>
|
||||||
|
util::region<T>::operator+ (vector<2,T> rhs) const
|
||||||
|
{
|
||||||
|
return { x + rhs.x, y + rhs.y, w, h };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool
|
bool
|
||||||
util::region<T>::operator== (const region& rhs) const
|
util::region<T>::operator== (const region& rhs) const
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "extent.hpp"
|
#include "extent.hpp"
|
||||||
#include "point.hpp"
|
#include "point.hpp"
|
||||||
|
#include "vector.hpp"
|
||||||
#include "types/traits.hpp"
|
#include "types/traits.hpp"
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
@ -80,6 +81,9 @@ namespace util {
|
|||||||
region& expand (T mag);
|
region& expand (T mag);
|
||||||
region& expand (T w, T h);
|
region& expand (T w, T h);
|
||||||
|
|
||||||
|
// arithmetic operators
|
||||||
|
region operator+ (vector<2,T>) const;
|
||||||
|
|
||||||
// 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…
x
Reference in New Issue
Block a user