src/container.cc
branchpyrit
changeset 74 09aedbf5f95f
parent 72 7c3f38dff082
child 78 9569e9f35374
--- a/src/container.cc	Sun Apr 20 19:27:59 2008 +0200
+++ b/src/container.cc	Mon Apr 21 08:47:36 2008 +0200
@@ -29,21 +29,22 @@
 
 void Container::addShape(Shape* aShape)
 {
+	const Float e = 10*Eps;
 	shapes.push_back(aShape);
 	if (shapes.size() == 0) {
 		/* initialize bounding box */
 		bbox = aShape->get_bbox();
-		Vector3 eps(Eps,Eps,Eps);
-		bbox = BBox(bbox.L - eps, bbox.H + eps);
+		const Vector3 E(e, e, e);
+		bbox = BBox(bbox.L - E, bbox.H + E);
 	} else {
 		/* adjust bounding box */
 		BBox shapebb = aShape->get_bbox();
-		if (shapebb.L.x - Eps < bbox.L.x)  bbox.L.x = shapebb.L.x - Eps;
-		if (shapebb.L.y - Eps < bbox.L.y)  bbox.L.y = shapebb.L.y - Eps;
-		if (shapebb.L.z - Eps < bbox.L.z)  bbox.L.z = shapebb.L.z - Eps;
-		if (shapebb.H.x + Eps > bbox.H.x)  bbox.H.x = shapebb.H.x + Eps;
-		if (shapebb.H.y + Eps > bbox.H.y)  bbox.H.y = shapebb.H.y + Eps;
-		if (shapebb.H.z + Eps > bbox.H.z)  bbox.H.z = shapebb.H.z + Eps;
+		if (shapebb.L.x - e < bbox.L.x)  bbox.L.x = shapebb.L.x - e;
+		if (shapebb.L.y - e < bbox.L.y)  bbox.L.y = shapebb.L.y - e;
+		if (shapebb.L.z - e < bbox.L.z)  bbox.L.z = shapebb.L.z - e;
+		if (shapebb.H.x + e > bbox.H.x)  bbox.H.x = shapebb.H.x + e;
+		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;
 	}
 };