inline void CompositeShape<T, D, O>::init()
{
max_isect = 0;
- for(typename ShapeArray::const_iterator i=shapes.begin(); i!=shapes.end(); ++i)
- max_isect += (*i)->get_max_ray_intersections();
+ for(Shape<T, D> *s: shapes)
+ max_isect += s->get_max_ray_intersections();
}
template<typename T, unsigned D, typename O>
shapes(other.shapes),
max_isect(other.max_isect)
{
- for(typename ShapeArray::iterator i=shapes.begin(); i!=shapes.end(); ++i)
- *i = (*i)->clone();
+ for(Shape<T, D> *&s: shapes)
+ s = s->clone();
}
template<typename T, unsigned D, typename O>
inline CompositeShape<T, D, O> &CompositeShape<T, D, O>::operator=(const CompositeShape<T, D, O> &other)
{
- for(typename ShapeArray::iterator i=shapes.begin(); i!=shapes.end(); ++i)
- delete *i;
+ for(Shape<T, D> *s: shapes)
+ delete s;
shapes = other.shapes;
- for(typename ShapeArray::iterator i=shapes.begin(); i!=shapes.end(); ++i)
- *i = (*i)->clone();
+ for(Shape<T, D> *&s: shapes)
+ s = s->clone();
max_isect = other.max_isect;
}
template<typename T, unsigned D, typename O>
inline CompositeShape<T, D, O>::~CompositeShape()
{
- for(typename ShapeArray::iterator i=shapes.begin(); i!=shapes.end(); ++i)
- delete *i;
+ for(Shape<T, D> *s: shapes)
+ delete s;
}
template<typename T, unsigned D, typename O>
return this->bisect_axis_aligned_bounding_box(detail);
BoundingBox<T, D> aabb;
- for(typename ShapeArray::const_iterator i=shapes.begin(); i!=shapes.end(); ++i)
+ for(auto i=shapes.begin(); i!=shapes.end(); ++i)
{
if(i==shapes.begin())
aabb = (*i)->get_axis_aligned_bounding_box();
inline bool CompositeShape<T, D, O>::contains(const LinAl::Vector<T, D> &point) const
{
bool inside = false;
- for(typename ShapeArray::const_iterator i=shapes.begin(); i!=shapes.end(); ++i)
+ for(Shape<T, D> *s: shapes)
{
- inside = (*i)->contains(point);
+ inside = s->contains(point);
if(Ops::shortcircuit(inside))
return inside;
}
int start_nesting = 0;
unsigned n = 0;
- for(typename ShapeArray::const_iterator i=shapes.begin(); (n<buf_size && i!=shapes.end()); ++i)
+ for(auto i=shapes.begin(); (n<buf_size && i!=shapes.end()); ++i)
{
unsigned base = n;
unsigned count = (*i)->get_intersections(ray, buffer+base, buf_size-base);
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)
+ for(auto i=shapes.begin(); i!=shapes.end(); ++i)
{
Coverage c = (*i)->get_coverage(bbox);
if(i==shapes.begin())