X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fintersection.h;h=24e668dc35a1924a70e1c3815fecbeac8147595e;hb=2826730b5d68d1ad74dc6363af43ca796f96caa2;hp=01707cdfc64274a79317179fc3faa96348c3c591;hpb=09cc3a8648dd20e9a07d669b353c4a120b67c1c4;p=libs%2Fmath.git diff --git a/source/geometry/intersection.h b/source/geometry/intersection.h index 01707cd..24e668d 100644 --- a/source/geometry/intersection.h +++ b/source/geometry/intersection.h @@ -6,20 +6,17 @@ namespace Msp { namespace Geometry { -/** -Forms a shape from the common parts of component shapes. -*/ template struct IntersectionOps { static BoundingBox combine_aabb(const BoundingBox &a, const BoundingBox &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 class Intersection: public CompositeShape > {