]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/negation.h
Optimize bounding box bisection with more early culling
[libs/math.git] / source / geometry / negation.h
index d90c4deb5a7de767b2f36cb0ed165d53f8a5c851..60b92e33d1d30def4d60f631c8311acbbcd0c115 100644 (file)
@@ -26,7 +26,7 @@ public:
 
        const Shape<T, D> &get_shape() const { return *shape; }
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box() const;
+       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
        virtual bool contains(const LinAl::Vector<T, D> &) const;
        virtual unsigned get_max_ray_intersections() const { return shape->get_max_ray_intersections(); }
        virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
@@ -64,9 +64,9 @@ inline Negation<T, D> *Negation<T, D>::clone() const
 }
 
 template<typename T, unsigned D>
-inline BoundingBox<T, D> Negation<T, D>::get_axis_aligned_bounding_box() const
+inline BoundingBox<T, D> Negation<T, D>::get_axis_aligned_bounding_box(unsigned detail) const
 {
-       return ~shape->get_axis_aligned_bounding_box();
+       return ~shape->get_axis_aligned_bounding_box(detail);
 }
 
 template<typename T, unsigned D>
@@ -96,7 +96,7 @@ inline Coverage Negation<T, D>::get_coverage(const BoundingBox<T, D> &bbox) cons
        else if(coverage==NO_COVERAGE)
                return FULL_COVERAGE;
        else
-               return PARTIAL_COVERAGE;
+               return coverage;
 }
 
 } // namespace Geometry