namespace Msp {
namespace Geometry {
-/**
-Forms a shape from the common parts of component shapes.
-*/
template<typename T, unsigned D>
struct IntersectionOps
{
static BoundingBox<T, D> combine_aabb(const BoundingBox<T, D> &a, const BoundingBox<T, D> &b) { return a&b; }
- static bool init_inside() { return true; }
- 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 ((a==PARTIAL_COVERAGE && b==a) ? UNCERTAIN_COVERAGE : std::min(a, b)); }
+ static bool shortcircuit(bool c) { return !c; }
};
+/**
+Forms a shape from the common parts of component shapes.
+*/
template<typename T, unsigned D>
class Intersection: public CompositeShape<T, D, IntersectionOps<T, D> >
{