+ init();
+}
+
+template<typename T, unsigned D, typename O>
+inline void CompositeShape<T, D, O>::init()
+{
+ max_isect = 0;
+ min_scratch = 0;
+ for(typename ShapeArray::const_iterator i=shapes.begin(); i!=shapes.end(); ++i)
+ {
+ unsigned mi = (*i)->get_max_ray_intersections();
+ max_isect += mi;
+ min_scratch = std::max(min_scratch, mi);
+ }
+}
+
+template<typename T, unsigned D, typename O>
+inline CompositeShape<T, D, O>::CompositeShape(const CompositeShape<T, D, O> &other):
+ shapes(other.shapes),
+ max_isect(other.max_isect),
+ min_scratch(other.min_scratch)
+{
+ for(typename ShapeArray::iterator i=shapes.begin(); i!=shapes.end(); ++i)
+ *i = (*i)->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;
+
+ shapes = other.shapes;
+ for(typename ShapeArray::iterator i=shapes.begin(); i!=shapes.end(); ++i)
+ *i = (*i)->clone();
+
+ max_isect = other.max_isect;
+ min_scratch = other.min_scratch;