]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/transformedshape.h
Add a function to test whether a shapes covers a bounding box
[libs/math.git] / source / geometry / transformedshape.h
index 6a14b0b75a1951f69a72cc9c3034fb56161dfc49..91790fc77276fd8aedbb75f318b856d775334cd2 100644 (file)
@@ -33,6 +33,7 @@ public:
        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;
+       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
 };
 
 template<typename T, unsigned D>
@@ -102,6 +103,12 @@ inline unsigned TransformedShape<T, D>::get_intersections(const Ray<T, D> &ray,
        return count;
 }
 
+template<typename T, unsigned D>
+inline Coverage TransformedShape<T, D>::get_coverage(const BoundingBox<T, D> &bbox) const
+{
+       return shape->get_coverage(inverse_trans.transform(bbox));
+}
+
 } // namespace Geometry
 } // namespace Msp