+ init();
+}
+
+template<typename T, unsigned D, typename O>
+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();
+}
+
+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)
+{
+ 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;