Index: trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp	(revision 423)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp	(revision 424)
@@ -531,12 +531,11 @@
 
 // returns selected plane for subdivision
-int
-VspKdTree::SelectPlane(VspKdTreeLeaf *leaf,
-					   const AxisAlignedBox3 &box,
-					   float &position,
-					   int &raysBack,
-					   int &raysFront,
-					   int &pvsBack,
-					   int &pvsFront)
+int VspKdTree::SelectPlane(VspKdTreeLeaf *leaf,
+						   const AxisAlignedBox3 &box,
+						   float &position,
+						   int &raysBack,
+						   int &raysFront,
+						   int &pvsBack,
+						   int &pvsFront)
 {
 	int minDirDepth = 6;
@@ -615,5 +614,5 @@
 	// this is the main ray classification loop!
     for(RayInfoContainer::iterator ri = leaf->mRays.begin();
-		ri != leaf->mRays.end();	ri++)
+		ri != leaf->mRays.end(); ++ ri)
 	{
 		if (!(*ri).mRay->IsActive()) 
@@ -640,7 +639,7 @@
 		
 	//		float sum = raysBack*(position - minBox) + raysFront*(maxBox - position);
-	float sum = pvsBack*(position - minBox) + pvsFront * (maxBox - position);
-
-	newCost = mCtDivCi + sum  /sizeBox;
+	float sum = pvsBack * (position - minBox) + pvsFront * (maxBox - position);
+
+	newCost = mCtDivCi + sum  / sizeBox;
 	
 	//	cout<<axis<<" "<<pvsSize<<" "<<pvsBack<<" "<<pvsFront<<endl;
@@ -677,5 +676,5 @@
 		if (!mOnlyDrivingAxis || axis == sAxis) 
 		{
-			nPosition[axis] = (sBox.Min()[axis] + sBox.Max()[axis])*0.5f;
+			nPosition[axis] = (sBox.Min()[axis] + sBox.Max()[axis]) * 0.5f;
 						
 			nCostRatio[axis] = EvalCostRatio(leaf,
@@ -728,4 +727,5 @@
 	int rl = 0, rr = (int)leaf->mRays.size();
 	int pl = 0, pr = leaf->GetPvsSize();
+
 	float minBox = box.Min(axis);
 	float maxBox = box.Max(axis);
@@ -739,7 +739,8 @@
 	
 	Intersectable::NewMail();
+
 	// set all object as belonging to the fron pvs
 	for(RayInfoContainer::iterator ri = leaf->mRays.begin();
-		ri != leaf->mRays.end();	++ ri)
+		ri != leaf->mRays.end(); ++ ri)
 	{
 		if ((*ri).mRay->IsActive())
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h	(revision 423)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h	(revision 424)
@@ -810,15 +810,15 @@
 	float mTermMaxAccRayLength;
 
+	float mCtDivCi;
+
+	/// if intersected leaves should be stored with a sample
 	bool mStoreLeavesWithRays;
 
 	/// axis aligned split criteria
-	float mCtDivCi;
+	float mAaCtDivCi;
 	float mSplitBorder;
 	float mMaxCostRatio;
 
 	// factors guiding the split plane heuristics
-	float mLeastSplitsFactor;
-	float mBalancedPolysFactor;
-	float mBalancedViewCellsFactor;
 	float mVerticalSplitsFactor;
 	float mLargestPolyAreaFactor;
@@ -827,4 +827,7 @@
 	float mBalancedRaysFactor;
 	float mPvsFactor;
+	float mLeastSplitsFactor;
+	float mBalancedPolysFactor;
+	float mBalancedViewCellsFactor;
 
 	//-- thresholds used for view cells merge
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp	(revision 421)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp	(revision 424)
@@ -1270,22 +1270,32 @@
 		 "-1");
 
+   RegisterOption("BspTree.Termination.ct_div_ci",
+		 optFloat,
+		 "-bsp_term_ct_div_ci=",
+		 "0.0");
+  
+  RegisterOption("BspTree.Termination.maxDepth",
+		 optInt,
+		 "-bsp_term_max_depth=",
+		 "100");
+
   RegisterOption("BspTree.Termination.AxisAligned.maxCostRatio",
 		 optFloat,
-		 "-bsp_term_max_cost_ratio=",
+		 "-bsp_term_axis_aligned_max_cost_ratio=",
 		 "1.5");
 
   RegisterOption("BspTree.Termination.AxisAligned.ct_div_ci",
 		 optFloat,
-		 "-bsp_term_ct_div_ci=",
-		 "1.0");
+		 "-bsp_term_axis_aligned_ct_div_ci=",
+		 "0.5");
 
   RegisterOption("BspTree.AxisAligned.splitBorder",
 		 optFloat,
-		 "-bsp_split_border=",
+		 "-bsp__axis_aligned_split_border=",
 		 "0.1");
 
   RegisterOption("BspTree.Termination.AxisAligned.maxPolys",
 		 optInt,
-		 "-bsp_term_max_polygons=",
+		 "-bsp_term_axis_aligned_max_polygons=",
 		 "50");
 
@@ -1297,11 +1307,6 @@
   RegisterOption("BspTree.Termination.AxisAligned.maxRays",
 		 optInt,
-		 "-bsp_term_max_rays=",
+		 "-bsp_term_axis_aligned_max_rays=",
 		 "-1");
-
-  RegisterOption("BspTree.Termination.maxDepth",
-		 optInt,
-		 "-bsp_term_max_depth=",
-		 "100");
 
   RegisterOption("BspTree.splitPlaneStrategy",
@@ -1330,8 +1335,18 @@
 	  "false");
 
+  RegisterOption("BspTree.Factor.verticalSplits", optFloat, "-bsp_factor_vertical=", "1.0");
+  RegisterOption("BspTree.Factor.largestPolyArea", optFloat, "-bsp_factor_largest_poly=", "1.0");
+  RegisterOption("BspTree.Factor.blockedRays", optFloat, "-bsp_factor_blocked=", "1.0");
+  RegisterOption("BspTree.Factor.leastRaySplits", optFloat, "-bsp_factor_least_ray_splits=", "1.0");
+  RegisterOption("BspTree.Factor.balancedRays", optFloat, "-bsp_factor_balanced_rays=", "1.0");
+  RegisterOption("BspTree.Factor.pvsFactor", optFloat, "-bsp_factor_pvs=", "1.0");
+  RegisterOption("BspTree.Factor.leastSplits", optFloat, "-bsp_factor_least_splits=", "1.0");
+  RegisterOption("BspTree.Factor.balancedPolys", optFloat, "-bsp_factor_balanced_polys=", "1.0");
+  RegisterOption("BspTree.Factor.balancedViewCells", optFloat, "-bsp_factor_balanced_view_cells=", "1.0");
+
   RegisterOption("Preprocessor.type",
-								 optString,
-								 "-preprocessor=",
-								 "sampling");
+				 optString,
+				 "-preprocessor=",
+				 "sampling");
 
 
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 423)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 424)
@@ -274,15 +274,4 @@
 mRoot(NULL), 
 mGenerateViewCells(false),
-//-- factors for bsp tree split plane heuristics
-mVerticalSplitsFactor(1.0f),
-mLargestPolyAreaFactor(1.0f),
-mBlockedRaysFactor(1.0f),
-mLeastRaySplitsFactor(1.0f),
-mBalancedRaysFactor(1.0f),
-mPvsFactor(1.0f),
-mLeastSplitsFactor(1.0f),
-mBalancedPolysFactor(1.0f),
-mBalancedViewCellsFactor(1.0f),
-//------------------------------------
 mStoreLeavesWithRays(false),
 mPvsUseArea(true)
@@ -299,6 +288,18 @@
 	environment->GetFloatValue("BspTree.Termination.maxAccRayLenght", mTermMaxAccRayLength);
 
+	//-- factors for bsp tree split plane heuristics
+	environment->GetFloatValue("BspTree.Factor.verticalSplits", mVerticalSplitsFactor);
+	environment->GetFloatValue("BspTree.Factor.largestPolyArea", mLargestPolyAreaFactor);
+	environment->GetFloatValue("BspTree.Factor.blockedRays", mBlockedRaysFactor);
+	environment->GetFloatValue("BspTree.Factor.leastRaySplits", mLeastRaySplitsFactor);
+	environment->GetFloatValue("BspTree.Factor.balancedRays", mBalancedRaysFactor);
+	environment->GetFloatValue("BspTree.Factor.pvsFactor", mPvsFactor);
+	environment->GetFloatValue("BspTree.Factor.leastSplits" , mLeastSplitsFactor);
+	environment->GetFloatValue("BspTree.Factor.balancedPolys", mBalancedPolysFactor);
+	environment->GetFloatValue("BspTree.Factor.balancedViewCells", mBalancedViewCellsFactor);
+	environment->GetFloatValue("BspTree.Termination.ct_div_ci", mCtDivCi);
+
 	//-- termination criteria for axis aligned split
-	environment->GetFloatValue("BspTree.Termination.AxisAligned.ct_div_ci", mCtDivCi);
+	environment->GetFloatValue("BspTree.Termination.AxisAligned.ct_div_ci", mAaCtDivCi);
 	environment->GetFloatValue("BspTree.Termination.AxisAligned.maxCostRatio", mMaxCostRatio);
 	environment->GetIntValue("BspTree.Termination.AxisAligned.maxPolys", 
@@ -1034,5 +1035,5 @@
   
 	float oldCost = (float)polys.size();
-	float newCost = mCtDivCi + minSum / boxArea;
+	float newCost = mAaCtDivCi + minSum / boxArea;
 	float ratio = newCost / oldCost;
 
@@ -1491,5 +1492,5 @@
 
 			if (!mPvsUseArea) // use front and back cell areas to approximate volume
-			{
+			{	
 				float len = Distance(entP, extP);
 				pOverall += len;
