public:
virtual ~CompositeShape();
- 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 max_isect; }
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, typename O>
}
template<typename T, unsigned D, typename O>
-inline BoundingBox<T, D> CompositeShape<T, D, O>::get_axis_aligned_bounding_box() const
+inline BoundingBox<T, D> CompositeShape<T, D, O>::get_axis_aligned_bounding_box(unsigned detail) const
{
+ if(detail)
+ return this->bisect_axis_aligned_bounding_box(detail);
+
BoundingBox<T, D> aabb;
for(typename ShapeArray::const_iterator i=shapes.begin(); i!=shapes.end(); ++i)
{
return 0;
n = k;
+
+ if(i!=shapes.begin())
+ start_nesting = (start_nesting>!Ops::shortcircuit(true));
}
if(buffer!=points)
return n;
}
+template<typename T, unsigned D, typename O>
+inline Coverage CompositeShape<T, D, O>::get_coverage(const BoundingBox<T, D> &bbox) const
+{
+ Coverage coverage = NO_COVERAGE;
+ for(typename ShapeArray::const_iterator i=shapes.begin(); i!=shapes.end(); ++i)
+ {
+ Coverage c = (*i)->get_coverage(bbox);
+ if(i==shapes.begin())
+ coverage = c;
+ else
+ coverage = Ops::combine_coverage(coverage, c);
+
+ if((coverage==NO_COVERAGE && Ops::shortcircuit(false)) || (coverage==FULL_COVERAGE && Ops::shortcircuit(true)))
+ break;
+ }
+
+ return coverage;
+}
+
} // namespace Geometry
} // namespace Msp