]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/union.h
Optimize bounding box bisection with more early culling
[libs/math.git] / source / geometry / union.h
index 8461f8484ee5d085560b6fb70f522447d9a95c6e..8c02f2b808dc8a18301653c77e8175e83b2ea555 100644 (file)
@@ -6,20 +6,17 @@
 namespace Msp {
 namespace Geometry {
 
-/**
-Joins component shapes together into one.
-*/
 template<typename T, unsigned D>
 struct UnionOps
 {
        static BoundingBox<T, D> combine_aabb(const BoundingBox<T, D> &a, const BoundingBox<T, D> &b) { return a|b; }
-       static bool init_inside() { return false; }
-       static bool combine_inside(bool a, bool b) { return a || b; }
-       static bool is_inside_decided(bool a) { return a; }
-       static bool init_surface() { return true; }
-       static bool combine_surface(bool a, bool b) { return a && !b; }
+       static Coverage combine_coverage(Coverage a, Coverage b) { return std::max(a, b); }
+       static bool shortcircuit(bool c) { return c; }
 };
 
+/**
+Joins component shapes together into one.
+*/
 template<typename T, unsigned D>
 class Union: public CompositeShape<T, D, UnionOps<T, D> >
 {