]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/transformedshape.h
Use the coverage function to calculate tighter bounding boxes
[libs/math.git] / source / geometry / transformedshape.h
index 91790fc77276fd8aedbb75f318b856d775334cd2..002f3c1a1cc859485decd5830f940137f33fda16 100644 (file)
@@ -29,7 +29,7 @@ public:
        const Shape<T, D> &get_shape() const { return *shape; }
        const AffineTransformation<T, D> &get_transformation() const { return transformation; }
 
-       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;
@@ -72,8 +72,11 @@ inline TransformedShape<T, D> *TransformedShape<T, D>::clone() const
 }
 
 template<typename T, unsigned D>
-inline BoundingBox<T, D> TransformedShape<T, D>::get_axis_aligned_bounding_box() const
+inline BoundingBox<T, D> TransformedShape<T, D>::get_axis_aligned_bounding_box(unsigned detail) const
 {
+       if(detail)
+               return this->bisect_axis_aligned_bounding_box(detail);
+
        return transformation.transform(shape->get_axis_aligned_bounding_box());
 }