X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fnegation.h;h=91802f8bce9906cfdadcae3bc7382c6e193cb423;hb=44bd1d1ab256d397be4e2169c4ca5efdd0569d31;hp=8e2b3f41a6d7c30681026176330d0ed1a04d965e;hpb=7919982691f0b8c69d8bef1bf6471b1e7a312163;p=libs%2Fmath.git diff --git a/source/geometry/negation.h b/source/geometry/negation.h index 8e2b3f4..91802f8 100644 --- a/source/geometry/negation.h +++ b/source/geometry/negation.h @@ -26,10 +26,11 @@ public: const Shape &get_shape() const { return *shape; } - virtual BoundingBox get_axis_aligned_bounding_box() const; + virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; virtual bool contains(const LinAl::Vector &) const; virtual unsigned get_max_ray_intersections() const { return shape->get_max_ray_intersections(); } virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; + virtual Coverage get_coverage(const BoundingBox &) const; }; template @@ -63,9 +64,9 @@ inline Negation *Negation::clone() const } template -inline BoundingBox Negation::get_axis_aligned_bounding_box() const +inline BoundingBox Negation::get_axis_aligned_bounding_box(unsigned detail) const { - return ~shape->get_axis_aligned_bounding_box(); + return ~shape->get_axis_aligned_bounding_box(detail); } template @@ -86,6 +87,18 @@ inline unsigned Negation::get_intersections(const Ray &ray, SurfaceP return count; } +template +inline Coverage Negation::get_coverage(const BoundingBox &bbox) const +{ + Coverage coverage = shape->get_coverage(bbox); + if(coverage==FULL_COVERAGE) + return NO_COVERAGE; + else if(coverage==NO_COVERAGE) + return FULL_COVERAGE; + else + return PARTIAL_COVERAGE; +} + } // namespace Geometry } // namespace Msp