src/container.cc
branchpyrit
changeset 78 9569e9f35374
parent 74 09aedbf5f95f
child 82 930a2d3ecaed
--- a/src/container.cc	Tue Apr 22 13:33:12 2008 +0200
+++ b/src/container.cc	Wed Apr 23 10:38:33 2008 +0200
@@ -26,11 +26,11 @@
 
 #include "common.h"
 #include "container.h"
+#include "serialize.h"
 
 void Container::addShape(Shape* aShape)
 {
-	const Float e = 10*Eps;
-	shapes.push_back(aShape);
+	const Float e = Eps;
 	if (shapes.size() == 0) {
 		/* initialize bounding box */
 		bbox = aShape->get_bbox();
@@ -46,6 +46,7 @@
 		if (shapebb.H.y + e > bbox.H.y)  bbox.H.y = shapebb.H.y + e;
 		if (shapebb.H.z + e > bbox.H.z)  bbox.H.z = shapebb.H.z + e;
 	}
+	shapes.push_back(aShape);
 };
 
 Shape *Container::nearest_intersection(const Shape *origin_shape, const Ray &ray,
@@ -58,3 +59,16 @@
 			nearest_shape = *shape;
 	return nearest_shape;
 }
+
+ostream & Container::dump(ostream &st)
+{
+	st << "(container," << shapes.size();
+	ShapeList::iterator shape;
+	for (shape = shapes.begin(); shape != shapes.end(); shape++)
+	{
+		int idx;
+		if (!shape_index.get(*shape, idx))
+			st << "," << **shape;
+	}
+	return st << ")";
+}