summaryrefslogtreecommitdiff
path: root/src/math.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math.hpp')
-rw-r--r--src/math.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math.hpp b/src/math.hpp
index f20cc99..c07b7d0 100644
--- a/src/math.hpp
+++ b/src/math.hpp
@@ -243,6 +243,18 @@ public:
return true;
}
+ friend rect_t<T, N> operator+(const rect_t<T, N> &a, const rect_t<T, N> &b)
+ {
+ rect_t r;
+
+ r[0][0] = std::min(a[0][0], b[0][0]);
+ r[0][1] = std::min(a[0][1], b[0][1]);
+ r[1][0] = std::max(a[1][0], b[1][0]);
+ r[1][1] = std::max(a[1][1], b[1][1]);
+
+ return r;
+ }
+
friend std::ostream& operator<<(std::ostream& stream, rect_t<T, N> r)
{
stream << "(" << r[0] << ", " << r[1] << ")";