Index: GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp	(revision 1020)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp	(revision 1047)
@@ -34,4 +34,6 @@
 							  const RgbColor &color)
 {
+	if (rays.empty())
+		return false;
   RayContainer::const_iterator ri = rays.begin();
 
@@ -48,5 +50,5 @@
   {
 	  stream << index << " " << index + 1 << " -1\n";
-	  index+=2;
+	  index += 2;
   }
   
@@ -68,5 +70,5 @@
 	  else
 	  {
-		  if ((*ri)->intersections.size()==0)
+		  if ((*ri)->intersections.empty())
 			  b = (*ri)->GetLoc() + length*(*ri)->GetDir();
 		  else
@@ -81,6 +83,5 @@
   stream << "}" << endl;
   stream << "}" << endl;
-  //stream << "}" << endl;
-
+  
   return true;
 }
@@ -90,5 +91,7 @@
 							  const RgbColor &color)
 {
-  VssRayContainer::const_iterator ri = rays.begin();
+
+	if (rays.empty())
+		return false;
 
   stream << "Shape {" << endl;
@@ -98,12 +101,14 @@
   stream << "}" << endl; // end material
   stream << "}" << endl; // end appearance
-  
+  Debug << "here8" << endl;
   stream << "geometry IndexedLineSet { coordIndex [" << endl;
 
   int index = 0;
-  for (; ri != rays.end(); ri++) 
+  VssRayContainer::const_iterator ri = rays.begin();
+
+  for (; ri != rays.end(); ++ ri) 
   {
 	  stream << index << " " << index + 1 << " -1\n";
-	  index +=2 ;
+	  index += 2 ;
   }
   
@@ -112,13 +117,14 @@
   stream << "coord Coordinate { point [" << endl;
   
-  ri = rays.begin();
-  for (; ri != rays.end(); ri++) {
-    const Vector3 a = (*ri)->GetOrigin();
-	const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir());
-	//const Vector3 b = (*ri)->GetTermination(); // matt: change back!!
-
-    stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,";
-	stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n";
+  for (ri = rays.begin(); ri != rays.end(); ++ ri) 
+  {
+	  const Vector3 a = (*ri)->GetOrigin();
+	  const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir());
+	  //const Vector3 b = (*ri)->GetTermination(); // matt: change back!!
+
+	  stream << a.x << " " << a.y << " " << a.z << " ,";
+	  stream << b.x << " " << b.y << " " << b.z << " ,\n";
   }
+
   stream << "]" << endl;
   stream << "}" << endl;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 1027)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 1047)
@@ -848,5 +848,5 @@
 
 		mBspStats.contributingSamples += conSamp;
-		mBspStats.sampleContributions +=(int) sampCon;
+		mBspStats.sampleContributions += (int)sampCon;
 
 		//-- store additional info
@@ -1224,11 +1224,11 @@
 			sc += contribution;
 		}
-	  
-	  sampleContributions += sc;
-
-	  if (madeContrib)
-		  ++ contributingSamples;
-		
-	  //leaf->mVssRays.push_back(ray);
+		
+		sampleContributions += sc;
+		
+		if (madeContrib)
+			++ contributingSamples;
+		
+		if (0) leaf->mVssRays.push_back(new VssRay(*ray));
 	}
 }
@@ -1573,5 +1573,6 @@
 					
 					// create back geometry from box
-					// NOTE: the geometry is saved when possible
+					// NOTE: the geometry is returned from the function so we
+					// don't have to recompute it when possible
 					pos = box.Max(); pos[axis] = nPosition[axis];
 					AxisAlignedBox3 bBox(box.Min(), pos);
@@ -2472,6 +2473,6 @@
 			extp = splitPlane.FindIntersection(ray.GetLoc(), extp, &t);
 			maxt *= t;
-
-		} else // reached leaf => intersection with view cell
+		} 
+		else // reached leaf => intersection with view cell
 		{
 			BspLeaf *leaf = dynamic_cast<BspLeaf *>(node);
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1027)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1047)
@@ -36,4 +36,5 @@
 class VspNode;
 class HierarchyManager;
+struct AxisAlignedPlane;
 
 struct BspRay;
@@ -349,5 +350,5 @@
 	virtual void ExportViewCellGeometry(Exporter *exporter, 
 										ViewCell *vc,
-										const Plane3 *clipPlane = NULL) const = 0;
+										const AxisAlignedPlane *clipPlane = NULL) const = 0;
 
 	/** Brings the view cells into their final state, computes meshes and volume.
@@ -574,5 +575,5 @@
 		
 	//Environment *environment;
-	Plane3 mClipPlane;
+	AxisAlignedPlane mClipPlane;
 
 	bool mUseClipPlaneForViz;
@@ -704,5 +705,5 @@
 	void ExportViewCellGeometry(Exporter *exporter, 
 								ViewCell *vc, 
-								const Plane3 *clipPlane = NULL) const;
+								const AxisAlignedPlane *clipPlane = NULL) const;
 	
 	void CollectMergeCandidates(const VssRayContainer &rays, 
@@ -788,5 +789,5 @@
 	void ExportViewCellGeometry(Exporter *exporter, 
 								ViewCell *vc,
-								const Plane3 *clipPlane = NULL) const;
+								const AxisAlignedPlane *clipPlane = NULL) const;
 
 	void CollectMergeCandidates(const VssRayContainer &rays, 
@@ -860,5 +861,5 @@
 	void ExportViewCellGeometry(Exporter *exporter, 
 								ViewCell *vc,
-								const Plane3 *clipPlane = NULL) const;
+								const AxisAlignedPlane *clipPlane = NULL) const;
 
 	//float GetVolume(ViewCell *viewCell) const;
@@ -1001,5 +1002,5 @@
 	void ExportViewCellGeometry(Exporter *exporter, 
 								ViewCell *vc,
-								const Plane3 *clipPlane = NULL) const;
+								const AxisAlignedPlane *clipPlane = NULL) const;
 
 	int ComputeBoxIntersections(const AxisAlignedBox3 &box, ViewCellContainer &viewCells) const;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp	(revision 1027)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp	(revision 1047)
@@ -771,23 +771,24 @@
 			sc += contribution;
 		}
-	  
-	  sampleContributions += sc;
-
-	  if (madeContrib)
-		  ++ contributingSamples;
+	 
+		sampleContributions += sc;
+
+		if (madeContrib)
+			++ contributingSamples;
 		
-	  //leaf->mVssRays.push_back(ray);
-	}
-}
-
-
-void VspTree::SortSplitCandidates(const RayInfoContainer &rays, 
-									 const int axis, 
-									 float minBand, 
-									 float maxBand)
+		if (1) leaf->mVssRays.push_back(new VssRay(*ray));
+	}
+}
+
+
+void VspTree::SortSplitCandidates(const RayInfoContainer &rays,
+								  const int axis, 
+								  float minBand, 
+								  float maxBand)
 {
 	mSplitCandidates->clear();
 
 	int requestedSize = 2 * (int)(rays.size());
+
 	// creates a sorted split candidates array
 	if (mSplitCandidates->capacity() > 500000 &&
@@ -863,5 +864,5 @@
 
 	
-	// if no border can be found, take mid split
+	// if no good split can be found, take mid split
 	position = minBox + 0.5f * sizeBox;
 	
@@ -952,5 +953,4 @@
 				}
 		}
-
 		
 		
@@ -978,22 +978,32 @@
 	
 	// -- compute cost
+
 	const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize();
 	const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize();
 
 	const float pOverall = sizeBox;
-
 	const float pBack = position - minBox;
 	const float pFront = maxBox - position;
-	
+
+	/*const float pOverall = box.GetVolume();
+
+	AxisAlignedBox3 bbox;
+	AxisAlignedBox3 fbox;
+
+	box.Split(axis, position, bbox, fbox);
+
+	const float pBack = fbox.GetVolume();
+	const float pFront = bbox.GetVolume();*/
+
 	const float penaltyOld = EvalPvsPenalty(pvsSize, lowerPvsLimit, upperPvsLimit);
     const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit);
 	const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit);
 	
-	const float oldRenderCost = penaltyOld * pOverall;
+	const float oldRenderCost = penaltyOld * pOverall + Limits::Small;
 	const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack;
 
 	if (splitPlaneFound)
 	{
-		ratio = newRenderCost / (oldRenderCost + Limits::Small);
+		ratio = newRenderCost / oldRenderCost;
 	}
 	//if (axis != 1)
@@ -1021,21 +1031,26 @@
 	int bestAxis = -1;
 
+	//mOnlyDrivingAxis = true;
+
 	// if we use some kind of specialised fixed axis
     const bool useSpecialAxis = 
 		mOnlyDrivingAxis || mCirculatingAxis;
-
-	int parentAxis = 0;
-	VspNode *parent = tData.mNode->GetParent();
-
-	if (parent)
-		parentAxis = dynamic_cast<VspInterior *>(parent)->GetAxis();
-
+	Debug << "data: " << tData.mBoundingBox << " pvs " << tData.mPvs << endl;
 	if (mCirculatingAxis)
+	{
+		int parentAxis = 0;
+		VspNode *parent = tData.mNode->GetParent();
+
+		if (parent)
+			parentAxis = dynamic_cast<VspInterior *>(parent)->GetAxis();
+
 		sAxis = (parentAxis + 1) % 3;
+	}
 	else if (mOnlyDrivingAxis)
+	{
 		sAxis = box.Size().DrivingAxis();
-
-
-	for (int axis = 0; axis < 3 ; ++ axis)
+	}
+	//sAxis = 2;
+	for (int axis = 0; axis < 3; ++ axis)
 	{
 		if (!useSpecialAxis || (axis == sAxis))
@@ -1070,17 +1085,24 @@
 			else if (nCostRatio[axis] < nCostRatio[bestAxis])
 			{
+				Debug << "old: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl;
 				bestAxis = axis;
+				
+				Debug << "new: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl;
 			} 
 		}
 	}
 
+
 	//-- assign values
+	
 	plane.mAxis = bestAxis;
+	// split plane position
+    plane.mPosition = nPosition[bestAxis];
+
 	pFront = nProbFront[bestAxis];
 	pBack = nProbBack[bestAxis];
 
-	//-- split plane position
-    plane.mPosition = nPosition[bestAxis];
-
+
+	Debug << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl;
 	return nCostRatio[bestAxis];
 }
@@ -1098,6 +1120,6 @@
 									  const VspTraversalData &data) const
 {
-#if 1
-	return -data.mDepth;
+#if 0
+	return (float)-data.mDepth;
 #endif
 	float pvsFront = 0;
@@ -1752,5 +1774,5 @@
 				if (extp[axis] <= position)
 				{
-					node = in->GetFront();
+					node = in->GetBack();
 					// cases N1,N2,N3,P5,Z2,Z3
 					continue;
@@ -1758,6 +1780,6 @@
 				{
 					// case N4
-					node = in->GetFront();
-					farChild = in->GetBack();
+					node = in->GetBack();
+					farChild = in->GetFront();
 				}
 			}
@@ -1766,5 +1788,5 @@
 				if (position <= extp[axis])
 				{
-					node = in->GetBack();
+					node = in->GetFront();
 					// cases P1,P2,P3,N5,Z1
 					continue;
@@ -1772,6 +1794,6 @@
 				else
 				{
-					node = in->GetBack();
-					farChild = in->GetFront();
+					node = in->GetFront();
+					farChild = in->GetBack();
 					// case P4
 				}
@@ -2086,5 +2108,7 @@
 		// get classification and receive new t
 		//-- test if start point behind or in front of plane
-		const int side = plane.ComputeRayIntersection(bRay, t);
+		const int side = bRay.ComputeRayIntersection(plane.mAxis, plane.mPosition, t);
+			
+
 #if 1
 		if (side == 0)
@@ -2157,8 +2181,8 @@
 	AxisAlignedBox3 box(parent->GetBoundingBox());
 
-	if (parent->GetBack() == node)
-		box.SetMin(parent->GetAxis(), parent->GetPosition());
-	else
-		box.SetMax(parent->GetAxis(), parent->GetPosition());
+	if (parent->GetFront() == node)
+      box.SetMin(parent->GetAxis(), parent->GetPosition());
+    else
+      box.SetMax(parent->GetAxis(), parent->GetPosition());
 
 	return box;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1027)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1047)
@@ -1747,8 +1747,5 @@
         Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis);
 
-	Vector3 normal(0,0,0);
-	normal[axis] = 1;
-
-	mClipPlane = Plane3(normal, point);
+	mClipPlane = AxisAlignedPlane(axis, point[axis]);
 }
 
@@ -2428,4 +2425,6 @@
 }
 
+
+
 /**********************************************************************/
 /*                 BspViewCellsManager implementation                 */
@@ -2927,5 +2926,5 @@
 void BspViewCellsManager::ExportViewCellGeometry(Exporter *exporter,
 												 ViewCell *vc,
-												 const Plane3 *clipPlane) const
+												 const AxisAlignedPlane *clipPlane) const
 {
 	// export mesh if available
@@ -2938,4 +2937,6 @@
 	if (clipPlane)
 	{
+		const Plane3 plane = clipPlane->GetPlane();
+
 		ViewCellContainer leaves;
 		mViewCellsTree->CollectLeaves(vc, leaves);
@@ -2953,5 +2954,5 @@
 
 			const float eps = 0.00000001f;
-			const int cf = geom.Side(*clipPlane, eps);
+			const int cf = geom.Side(plane, eps);
 
 			if (cf == -1)
@@ -2963,5 +2964,5 @@
 				geom.SplitGeometry(front,
 								   back,
-								   *clipPlane,
+								   plane,
 								   mViewSpaceBox, 
 								   eps);
@@ -3067,5 +3068,7 @@
 
 
-bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects)
+bool BspViewCellsManager::ExportViewCells(const string filename, 
+										  const bool exportPvs, 
+										  const ObjectContainer &objects)
 {
 #if STILL_HAS_TODO
@@ -3472,5 +3475,5 @@
 void KdViewCellsManager::ExportViewCellGeometry(Exporter *exporter,
 												ViewCell *vc,
-												const Plane3 *clipPlane) const
+												const AxisAlignedPlane *clipPlane) const
 {
 	ViewCellContainer leaves;
@@ -4154,5 +4157,6 @@
 	//-- export view cells
 	if (1) 
-	{	// hack pvs
+	{	
+		// hack pvs
 		const int savedColorCode = mColorCode;
 		mColorCode = 1;
@@ -4178,5 +4182,5 @@
 
 			// export rays
-			if (1 && mExportRays)
+			if (0 && mExportRays)
 			{
 				exporter->ExportRays(visRays, RgbColor(0, 1, 0));
@@ -4359,5 +4363,5 @@
 		{
 			// output rays stored with the view cells during subdivision
-			if (0)
+			if (1)
 			{
 				VssRayContainer vcRays;
@@ -4394,4 +4398,6 @@
 				}
 
+				Debug << "here233 " << (int)vcRays.size() << endl;
+
 				//-- export rays piercing this view cell
 				exporter->ExportRays(vcRays, RgbColor(1, 1, 1));
@@ -4399,5 +4405,5 @@
 		
 			// associate new rays with output view cell
-			if (1)
+			if (0)
 			{
 				VssRayContainer vcRays;
@@ -4580,8 +4586,10 @@
 void VspBspViewCellsManager::ExportViewCellGeometry(Exporter *exporter,
                                                     ViewCell *vc,
-													const Plane3 *clipPlane) const
+													const AxisAlignedPlane *clipPlane) const
 {
 	if (clipPlane)
 	{
+		const Plane3 plane = clipPlane->GetPlane();
+
 		ViewCellContainer leaves;
 		mViewCellsTree->CollectLeaves(vc, leaves);
@@ -4599,5 +4607,5 @@
 
 			const float eps = 0.00000001f;
-			const int cf = geom.Side(*clipPlane, eps);
+			const int cf = geom.Side(plane, eps);
 
 			if (cf == -1)
@@ -4609,5 +4617,5 @@
 				geom.SplitGeometry(front,
 								   back,
-								   *clipPlane,
+								   plane,
 								   mViewSpaceBox, 
 								   eps);
@@ -4780,5 +4788,5 @@
 
 /**************************************************************************/
-/*                   VspBspViewCellsManager implementation                */
+/*                   VspOspViewCellsManager implementation                */
 /**************************************************************************/
 
@@ -5136,4 +5144,5 @@
 	{
 		viewPoint = mViewSpaceBox.GetRandomPoint();
+
 		if (mVspTree->ViewPointValid(viewPoint))
 		{
@@ -5149,5 +5158,5 @@
 void VspOspViewCellsManager::ExportViewCellGeometry(Exporter *exporter,
 													ViewCell *vc,
-													const Plane3 *clipPlane) const
+													const AxisAlignedPlane *clipPlane) const
 {
 	ViewCellContainer leaves;
@@ -5156,4 +5165,9 @@
 	ViewCellContainer::const_iterator it, it_end = leaves.end();
 
+	Plane3 plane;
+	
+	if (clipPlane)
+		plane = clipPlane->GetPlane();
+
 	for (it = leaves.begin(); it != it_end; ++ it)
 	{
@@ -5162,7 +5176,22 @@
 
 		const AxisAlignedBox3 box = mVspTree->GetBBox(vspVc->mLeaf);
-
-		if (!clipPlane || !box.Side(*clipPlane))
+		
+		if (clipPlane)
+		{
+			if (box.Side(plane) == -1)
+				exporter->ExportBox(box);
+			else if (box.Side(plane) == 0)
+			{
+				AxisAlignedBox3 fbox, bbox;
+
+				box.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox);
+
+				exporter->ExportBox(bbox);
+			}
+		}
+		else
+		{
 			exporter->ExportBox(box);
+		}
 	}
 }
@@ -5191,7 +5220,8 @@
 	//-- export view cells
 	if (1) 
-	{	// hack pvs
+	{	
+		// hack pvs
 		const int savedColorCode = mColorCode;
-		mColorCode = 1;
+		mColorCode = 0;
 	
 		Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl");
@@ -5215,5 +5245,5 @@
 
 			// export rays
-			if (1 && mExportRays)
+			if (0 && mExportRays)
 			{
 				exporter->ExportRays(visRays, RgbColor(0, 1, 0));
@@ -5292,5 +5322,5 @@
 		{
 			// output rays stored with the view cells during subdivision
-			if (0)
+			if (1)
 			{
 				VssRayContainer vcRays;
@@ -5298,4 +5328,6 @@
 
 				raysOut = min((int)rays.size(), 100);
+
+				Debug  << "here12 " << raysOut << endl;
 
 				// collect intial view cells
@@ -5307,5 +5339,5 @@
 				for (vit = leaves.begin(); vit != vit_end; ++ vit)
 				{
-					BspLeaf *vcLeaf = dynamic_cast<BspViewCell *>(*vit)->mLeaf;
+					VspLeaf *vcLeaf = dynamic_cast<VspViewCell *>(*vit)->mLeaf;
 				
 					VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end();
@@ -5332,5 +5364,5 @@
 		
 			// associate new rays with output view cell
-			if (1)
+			if (0)
 			{
 				VssRayContainer vcRays;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h	(revision 1027)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h	(revision 1047)
@@ -42,23 +42,4 @@
 		return c1->GetPriority() < c2->GetPriority();
 	}
-};
-
-/** A definition for an axis aligned plane.
-*/
-struct AxisAlignedPlane
-{
-public:
-
-	/** Computes intersection of this plane with the ray segment.
-	*/
-	int ComputeRayIntersection(const RayInfo &rayData, float &t) const
-	{
-		return rayData.ComputeRayIntersection(mAxis, mPosition, t);
-	}
-
-	/// the split axis: one of 0=x, 1=y, 2=z
-	int mAxis;
-	/// the absolute position of the split axis
-	float mPosition;
 };
 
@@ -410,4 +391,12 @@
 	void SetBoundingBox(const AxisAlignedBox3 &box);
 
+	/** Computes intersection of this plane with the ray segment.
+	*/
+	int ComputeRayIntersection(const RayInfo &rayData, float &t) const
+	{
+		return rayData.ComputeRayIntersection(mPlane.mAxis, mPlane.mPosition, t);
+	}
+
+
 protected:
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h	(revision 860)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h	(revision 1047)
@@ -77,4 +77,29 @@
   
 
+/** A definition for an axis aligned plane.
+*/
+struct AxisAlignedPlane
+{
+public:
+	AxisAlignedPlane(){}
+	AxisAlignedPlane(const int axis, const float position):
+	  mAxis(axis), mPosition(position)
+	  {
+	  }
+	Plane3 GetPlane() const
+	{
+		Vector3 normal(0,0,0); normal[mAxis] = 1;
+		Vector3 point(0,0,0); point[mAxis] = mPosition;
+
+        return Plane3(normal, point);
+	}
+
+	/// the split axis: one of 0=x, 1=y, 2=z
+	int mAxis;
+	/// the absolute position of the split axis
+	float mPosition;
+};
+
+
 }
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp	(revision 1012)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp	(revision 1047)
@@ -2123,18 +2123,20 @@
 }
 
+
 void AxisAlignedBox3::Split(const int axis, 
 							const float value, 
-							AxisAlignedBox3 &left, 
-							AxisAlignedBox3 &right) const
+							AxisAlignedBox3 &front, 
+							AxisAlignedBox3 &back) const
 {
 	if ( (value >= mMin[axis]) && (value <= mMax[axis]) )
 	{
-		left.mMin = mMin; left.mMax = mMax;
-		right.mMin = mMin; right.mMax = mMax;
-
-		left.mMax[axis] = value;
-		right.mMin[axis] = value;
-
+		front.mMin = mMin; front.mMax = mMax;
+		back.mMin = mMin; back.mMax = mMax;
+
+		back.mMax[axis] = value;
+		front.mMin[axis] = value;
 	}
 }
-}
+
+
+}
