src/container.cc
branchpyrit
changeset 72 7c3f38dff082
parent 44 3763b26244f0
child 74 09aedbf5f95f
--- a/src/container.cc	Sat Apr 19 18:00:27 2008 +0200
+++ b/src/container.cc	Sun Apr 20 16:48:24 2008 +0200
@@ -33,15 +33,17 @@
 	if (shapes.size() == 0) {
 		/* initialize bounding box */
 		bbox = aShape->get_bbox();
+		Vector3 eps(Eps,Eps,Eps);
+		bbox = BBox(bbox.L - eps, bbox.H + eps);
 	} else {
 		/* adjust bounding box */
 		BBox shapebb = aShape->get_bbox();
-		if (shapebb.L.x < bbox.L.x)  bbox.L.x = shapebb.L.x;
-		if (shapebb.L.y < bbox.L.y)  bbox.L.y = shapebb.L.y;
-		if (shapebb.L.z < bbox.L.z)  bbox.L.z = shapebb.L.z;
-		if (shapebb.H.x > bbox.H.x)  bbox.H.x = shapebb.H.x;
-		if (shapebb.H.y > bbox.H.y)  bbox.H.y = shapebb.H.y;
-		if (shapebb.H.z > bbox.H.z)  bbox.H.z = shapebb.H.z;
+		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;
 	}
 };