X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fgeometry%2Ftransformedshape.h;h=9387123508dcf081341c076f8c4e41970a10ead0;hb=2826730b5d68d1ad74dc6363af43ca796f96caa2;hp=002f3c1a1cc859485decd5830f940137f33fda16;hpb=44bd1d1ab256d397be4e2169c4ca5efdd0569d31;p=libs%2Fmath.git diff --git a/source/geometry/transformedshape.h b/source/geometry/transformedshape.h index 002f3c1..9387123 100644 --- a/source/geometry/transformedshape.h +++ b/source/geometry/transformedshape.h @@ -109,7 +109,30 @@ inline unsigned TransformedShape::get_intersections(const Ray &ray, template inline Coverage TransformedShape::get_coverage(const BoundingBox &bbox) const { - return shape->get_coverage(inverse_trans.transform(bbox)); + BoundingBox local_bbox = inverse_trans.transform(bbox); + Coverage coverage = shape->get_coverage(local_bbox); + if(coverage==PARTIAL_COVERAGE) + { + BoundingBox outer_bbox = transformation.transform(local_bbox); + LinAl::Vector min_pt = local_bbox.get_minimum_point(); + LinAl::Vector max_pt = local_bbox.get_maximum_point(); + for(unsigned i=0; i(min_pt, max_pt); + if(shape->get_coverage(local_bbox)>=PARTIAL_COVERAGE) + return PARTIAL_COVERAGE; + else + return UNCERTAIN_COVERAGE; + } + else + return coverage; } } // namespace Geometry