Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 289)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 290)
@@ -185,20 +185,21 @@
 Debug << "*************\n";
 Debug << "initial poly\n" << *poly << endl;
-				//-- split polygon
+				//-- split polygon into front and back part
 				poly->Split(&mPlane, front_piece, back_piece);
-				++ splits;
+
+				++ splits; // increase number of splits
 			
-				//Debug << "poly\n" << *poly << "split front piece not valid\n" << *front_piece << endl;
-				//Debug << "poly\n" << *poly << "split back piece not valid\n" << *back_piece << endl;
-
-				if (front_piece->CheckValid())
+				if (front_piece->mVertices.size() >= 3) // check if polygon still valid 
 					frontPolys->push_back(front_piece);
-				else
-					DEL_PTR(front_piece);
+				else{
+					Debug << "poly\n" << *poly << "split front piece not valid\n" << *front_piece << endl;
+					DEL_PTR(front_piece);}
 				
-				//if (back_piece->CheckValid())
+				if (back_piece->mVertices.size() >= 3) // check if polygon still valid
 					backPolys->push_back(back_piece);
-				//else
-				//	DEL_PTR(back_piece);
+				else{
+					Debug << "poly\n" << *poly << "split back piece not valid\n" << *back_piece << endl;
+					DEL_PTR(back_piece);}
+				
 Debug << "*************\n";
 #ifdef _DEBUG
@@ -518,5 +519,5 @@
  	// copy view cell meshes into one big polygon soup
 	PolygonContainer *polys = new PolygonContainer();
-	Copy2PolygonSoup(viewCells, *polys);
+	mStat.polys = Copy2PolygonSoup(viewCells, *polys);
 
 	// construct tree from viewcell polygons
@@ -626,8 +627,9 @@
 										  &coincident);
 
-	if (coincident.size() == 0) 
-	{
-		Debug << "size is zero at depth " << tData.mDepth << ", #back polys: " << (int)backPolys->size() << ", #front polys: " << (int)frontPolys->size() << endl;
-		if (frontPolys) Debug << "front poly: " << *frontPolys->back() << endl;
+	if ((backPolys->size() == 0) && (coincident.size() > 1)) 
+	{
+		Debug << "WARNING: size " << coincident.size() << " at depth " << tData.mDepth << ", #back polys: " << (int)backPolys->size() << ", #front polys: " << (int)frontPolys->size() << endl;
+		for (int i=0; i<coincident.size();++i)
+			Debug << "coincident " << i << " vc " << coincident[i]->mParent << endl;
 	}
 	//Debug << "coincident size: " << coincident.size() << endl;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Plane3.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Plane3.h	(revision 289)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Plane3.h	(revision 290)
@@ -48,18 +48,15 @@
     if (signum(dv) == 0)
 	{
-		if (coplanar) 
-			(*coplanar) = true;	
-	
+		if (coplanar) (*coplanar) = true;	
+		if (t) (*t) = 1;
 		return a;
 	}
+	
+    float u = - Distance(a) / dv; // TODO: could be done more efficiently
     
-    float u = - Distance(a) / dv; // TODO: could be done more efficiently
-    //Debug << "t: " << u << ", b - a: " << v << ", norm: " << mNormal << ", dist(a): " << - Distance(a) << ", dv: " << dv << endl;
-    if (coplanar) 
-      (*coplanar) = false;
-    
-    if (t) 
-      (*t) = u;
-    
+	if (coplanar) (*coplanar) = false;
+	if (t) (*t) = u;
+	
+	//Debug << "t: " << u << ", b - a: " << v << ", norm: " << mNormal << ", dist(a): " << - Distance(a) << ", dv: " << dv << endl;
     //return a - Distance(a) * b / dv + Distance(a) * a / dv; // NOTE: gives better precision than calclulating a + u * v
     return a + u * v;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp	(revision 289)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp	(revision 290)
@@ -63,5 +63,6 @@
 				//-- plane - line intersection
 				Vector3 splitPt = partition->FindIntersection(ptA, ptB);
-				Debug << "front split pt " << splitPt << " ptA " << ptA << " ptB " << ptB << " side " << sideB << endl;
+				Debug << "fpg " << splitPt << " side " << partition->Side(splitPt, SIDE_TOLERANCE) << 
+					"\nptA " << ptA << " side " << sideA << "\nptB " << ptB << " side " << sideB << " " << Distance(ptB, splitPt) << endl;
 				if (!foundSplit || (SqrDistance(splitPt, prevSplitPt) > SIDE_TOLERANCE_SQRD))
 				{
