summary refs log tree commit diff
path: root/src/Math/AABB.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Math/AABB.hpp')
-rw-r--r--src/Math/AABB.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Math/AABB.hpp b/src/Math/AABB.hpp
index 22de760..53ce6d2 100644
--- a/src/Math/AABB.hpp
+++ b/src/Math/AABB.hpp
@@ -2,6 +2,7 @@
 
 #include <array>
 #include "Vector.hpp"
+#include "../Common/Lambda.hpp"
 
 struct AABB {
     AABB() = default;
@@ -60,6 +61,13 @@ struct AABB {
         return {center() - new_size / 2, center() + new_size / 2};
     }
 
+    AABB unite(AABB with) const {
+        return {
+            min.zip(with.min, LAMBDA(std::min, 2)),
+            max.zip(with.max, LAMBDA(std::max, 2))
+        };
+    }
+
     AABB collision_response(Vector<3> v, AABB against) const;
 
     Vector<3> min, max;