Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1786)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1787)
@@ -75,45 +75,4 @@
 
 
-class LocalMergeLeaf: public LocalMergeNode
-{
-public:
-	LocalMergeLeaf(ViewCell *vc): mViewCell(vc) {};
-	virtual ~LocalMergeLeaf() {};
-	virtual bool IsLeaf() const { return true; }
-
-	ViewCell *mViewCell;
-};
-
-
-class LocalMergeInterior: public LocalMergeNode
-{
-public:
-	
-	virtual ~LocalMergeInterior() {DEL_PTR(mLeft); DEL_PTR(mRight);}
-	virtual bool IsLeaf() const { return false; }
-
-	LocalMergeNode *mLeft;
-	LocalMergeNode *mRight;
-};
-
-
-class LocalMergeTree
-{
-public:
-
-	LocalMergeTree(const ViewCellContainer &viewCells);
-	
-	void Merge(ObjectPvs &mergedPvs);
-
-protected:
-
-	void Merge(LocalMergeNode *node, ObjectPvs &mergedPvs);
-	LocalMergeNode *Subdivide(const int leftIdx, const int rightIdx);
-
-	LocalMergeNode *mRoot;
-	const ViewCellContainer &mViewCells;
-};
-
-
 /**	Manages different higher order operations on the view cells.
 */
@@ -505,5 +464,6 @@
 	/** Efficiently merges the view cells in the container.
 	*/
-	void MergeViewCellsEfficient(ObjectPvs &pvs, const ViewCellContainer &viewCells) const;
+	void MergeViewCellsRecursivly(ObjectPvs &pvs, 
+								  const ViewCellContainer &viewCells) const;
 
 
@@ -606,4 +566,9 @@
 
 protected:
+
+	void MergeViewCellsRecursivly(ObjectPvs &pvs, 
+								  const ViewCellContainer &viewCells, 
+								  const int leftIdx, 
+								  const int rightIdx) const;
 
 	/** Intersects box with the tree and returns the number of intersected boxes.
Index: GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 1786)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 1787)
@@ -523,7 +523,9 @@
 
 	void ComputePvs(const ObjectPvs &pvs, float &rc, int &pvsEntries);
-	void GetPvsIncrementally(ViewCell *vc, ObjectPvs &pvs) const;
+	void GetPvsIncrementially(ViewCell *vc, ObjectPvs &pvs) const;
 	void PullUpPvsIncrementally(ViewCell *viewCell) const;
 	void GetPvsRecursive(ViewCell *vc, ObjectPvs &pvs) const;
+	void GetPvsEfficiently(ViewCell *vc, ObjectPvs &pvs) const;
+
 protected:
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1786)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1787)
@@ -2159,5 +2159,5 @@
 	
 	if (mApplyInitialPartition)
-	{cout << "here29"<<endl;
+	{
 		ApplyInitialSubdivision(oSubdivisionCandidate, tQueue);		
 	}
@@ -2517,5 +2517,5 @@
 	tempQueue.Push(firstCandidate);
 	while (!tempQueue.Empty())
-	{cout << "here2"<<endl;
+	{
 		SubdivisionCandidate *candidate = tempQueue.Top();
 		tempQueue.Pop();
@@ -2529,5 +2529,4 @@
 		if (!InitialTerminationCriteriaMet(bsc->mParentData))
 		{
-			cout << "here12"<<endl;
 			cout << "here9"<<bsc->mParentData.mNode->mObjects.size()<<endl;
 			BvhNode *node = Subdivide(tempQueue, bsc, globalCriteriaMet);
@@ -2555,9 +2554,9 @@
 
 	ObjectContainer::const_iterator oit, oit_end = objects->end();
-    cout<<"here104"<<endl;
-	for (oit = objects->begin(); oit != objects->end(); ++ oit)
-	{
-		//cout << (*oit)->GetBox().SurfaceArea() << " ";
-	}
+   
+	/*for (oit = objects->begin(); oit != objects->end(); ++ oit)
+	{
+		cout << (*oit)->GetBox().SurfaceArea() << " ";
+	}*/
 
 	float maxAreaDiff = -1.0f;
@@ -2566,5 +2565,5 @@
 
     for (oit = objects->begin(); oit != (objects->end() - 1); ++ oit)
-	{//cout << "h";
+	{
 		Intersectable *objS = *oit;
 		Intersectable *objL = *(oit + 1);
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1786)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1787)
@@ -32,5 +32,5 @@
 
 // $$JB HACK
-#define USE_KD_PVS 1
+#define USE_KD_PVS 0
 #define KD_PVS_AREA (1e-5f)
 
@@ -2591,9 +2591,32 @@
 
 
-void ViewCellsManager::MergeViewCellsEfficient(ObjectPvs &pvs, const ViewCellContainer &viewCells) const
-{
-	LocalMergeTree mergeTree(viewCells);
-	mergeTree.Merge(pvs);
-}
+void ViewCellsManager::MergeViewCellsRecursivly(ObjectPvs &pvs, 
+												const ViewCellContainer &viewCells) const
+{
+	MergeViewCellsRecursivly(pvs, viewCells, 0, (int)viewCells.size() - 1);
+}
+
+
+void ViewCellsManager::MergeViewCellsRecursivly(ObjectPvs &pvs, 
+												const ViewCellContainer &viewCells, 
+												const int leftIdx, 
+												const int rightIdx) const
+{
+	if (leftIdx == rightIdx)
+	{
+		pvs = viewCells[leftIdx]->GetPvs();
+	}
+	else
+	{
+		const int midSplit = (leftIdx + rightIdx) / 2;
+        
+		ObjectPvs leftPvs, rightPvs;
+		MergeViewCellsRecursivly(leftPvs, viewCells, leftIdx, midSplit);
+		MergeViewCellsRecursivly(rightPvs, viewCells, midSplit, rightIdx);
+
+        ObjectPvs::Merge(pvs, leftPvs, rightPvs);
+	}
+}
+
 
 #if 1
@@ -2605,4 +2628,5 @@
 							   )
 {
+	cout<<"y";
   PvsFilterStatistics stats;
 
@@ -2629,5 +2653,5 @@
   float samples = (float)basePvs.GetSamples();
   
-  Debug<<"f #s="<<samples<<"pvs size = "<<basePvs.GetSize();
+  Debug<<"f #s="<<samples<<"  pvs size = "<<basePvs.GetSize();
   //  cout<<"Filter size = "<<filterSize<<endl;
   //  cout<<"vbox = "<<vbox<<endl;
@@ -2754,144 +2778,162 @@
 							   ObjectPvs &pvs
 							   )
-{cout << "x";
-  PvsFilterStatistics stats;
-
-  AxisAlignedBox3 vbox = GetViewCellBox(viewCell);
-  Vector3 center = vbox.Center();
-  // copy the PVS
-  ObjectPvs basePvs = viewCell->GetPvs();
-  Intersectable::NewMail();
-
-  ObjectPvsIterator pit = basePvs.GetIterator();
+{
+	cout << "x";
+	PvsFilterStatistics stats;
+
+	AxisAlignedBox3 vbox = GetViewCellBox(viewCell);
+	Vector3 center = vbox.Center();
+	// copy the PVS
+	ObjectPvs basePvs;// = viewCell->GetPvs();
+	Intersectable::NewMail();
+
+	ObjectPvsIterator pit = viewCell->GetPvs().GetIterator();
 
 #if !USE_KD_PVS
-  // first mark all object from this pvs
-  while (pit.HasMoreEntries()) {		
-	ObjectPvsEntry entry = pit.Next();
-	
-	Intersectable *object = entry.mObject;
-	object->Mail();
-  }
+	// first mark all object from this pvs
+	while (pit.HasMoreEntries()) 
+	{		
+		ObjectPvsEntry entry = pit.Next();
+
+		Intersectable *object = entry.mObject;
+		object->Mail();
+	}
 #endif
 
-  int pvsSize = 0;
-  int nPvsSize = 0;
-  float samples = (float)basePvs.GetSamples();
-  
-  Debug<<"f #s="<<samples<<"pvs size = "<<basePvs.GetSize();
-  //  cout<<"Filter size = "<<filterSize<<endl;
-  //  cout<<"vbox = "<<vbox<<endl;
-  //  cout<<"center = "<<center<<endl;
-
-
-   // Minimal number of local samples to take into account
-   // the local sampling density.
-   // The size of the filter is a minimum of the conservative
-   // local sampling density estimate (#rays intersecting teh viewcell and
-   // the object)
-   // and gobal estimate for the view cell
-   // (total #rays intersecting the viewcell)
+	int pvsSize = 0;
+	int nPvsSize = 0;
+	float samples = (float)viewCell->GetPvs().GetSamples();
+
+	Debug<<"f #s="<<samples<<"pvs size = "<<viewCell->GetPvs().GetSize();
+	//  cout<<"Filter size = "<<filterSize<<endl;
+	//  cout<<"vbox = "<<vbox<<endl;
+	//  cout<<"center = "<<center<<endl;
+
+
+	// Minimal number of local samples to take into account
+	// the local sampling density.
+	// The size of the filter is a minimum of the conservative
+	// local sampling density estimate (#rays intersecting teh viewcell and
+	// the object)
+	// and gobal estimate for the view cell
+	// (total #rays intersecting the viewcell)
 #define MIN_LOCAL_SAMPLES 5
 
-  float viewCellRadius = 0.5f*Magnitude(vbox.Diagonal());
-  
-  // now compute the filter box around the current viewCell
-  
-  if (useViewSpaceFilter) {
-	//	float radius = Max(viewCellRadius/100.0f, avgRadius - viewCellRadius);
-	float radius = viewCellRadius/100.0f;
-	vbox.Enlarge(radius);
-	cout<<"vbox = "<<vbox<<endl;
-	ViewCellContainer viewCells;
-	ComputeBoxIntersections(vbox, viewCells);
-	ObjectPvs pvs;
-	MergeViewCellsEfficient(pvs, viewCells);
-	basePvs = pvs;
-		
-	// update samples and globalC
-	samples = (float)pvs.GetSamples();
-	//	cout<<"neighboring viewcells = "<<i-1<<endl;
-	//	cout<<"Samples' = "<<samples<<endl;
-  }
-
-  // Minimal number of samples so that filtering takes place
+	float viewCellRadius = 0.5f*Magnitude(vbox.Diagonal());
+
+	// now compute the filter box around the current viewCell
+
+	if (useViewSpaceFilter) 
+	{
+		//	float radius = Max(viewCellRadius/100.0f, avgRadius - viewCellRadius);
+		float radius = viewCellRadius/100.0f;
+		vbox.Enlarge(radius);
+		cout<<"vbox = "<<vbox<<endl;
+		ViewCellContainer viewCells;
+		ComputeBoxIntersections(vbox, viewCells);
+		
+		MergeViewCellsEfficient(basePvs, viewCells);
+		cout << "basepvs size " << basePvs.GetSize() << endl;
+		// update samples and globalC
+		samples = (float)pvs.GetSamples();
+		//	cout<<"neighboring viewcells = "<<i-1<<endl;
+		//	cout<<"Samples' = "<<samples<<endl;
+	}
+	else
+	{
+		basePvs = viewCell->GetPvs();
+	}
+
+	// Minimal number of samples so that filtering takes place
 #define MIN_SAMPLES  100
-  if (samples > MIN_SAMPLES) {
-	float globalC = 2.0f*filterSize/sqrt(samples);
-	
+	if (samples > MIN_SAMPLES) 
+	{
+		float globalC = 2.0f*filterSize/sqrt(samples);
+
+		pit = basePvs.GetIterator();
+
+		ObjectContainer objects;
+
+		while (pit.HasMoreEntries())
+		{		
+			ObjectPvsEntry entry = pit.Next();
+
+			Intersectable *object = entry.mObject;
+			// compute filter size based on the distance and the numebr of samples
+			AxisAlignedBox3 box = object->GetBox();
+
+			float distance = Distance(center, box.Center());
+			float globalRadius = distance*globalC;
+
+			int objectSamples = (int)entry.mData.mSumPdf;
+			float localRadius = MAX_FLOAT;
+
+			if (objectSamples > MIN_LOCAL_SAMPLES)
+			{
+				localRadius = filterSize*0.5f*Magnitude(box.Diagonal())/
+								sqrt((float)objectSamples);
+			}
+
+			//	cout<<"lr="<<localRadius<<" gr="<<globalRadius<<endl;
+
+			// now compute the filter size
+			float radius;
+
+			if (localRadius < globalRadius) 
+			{
+				radius = localRadius;
+				stats.mLocalFilterCount++;
+			} 
+			else 
+			{
+				radius = globalRadius;
+				stats.mGlobalFilterCount++;
+			}
+
+			stats.mAvgFilterRadius += radius;
+
+			// cout<<"box = "<<box<<endl;
+			//	cout<<"distance = "<<distance<<endl;
+			//	cout<<"radiues = "<<radius<<endl;
+
+			box.Enlarge(Vector3(radius));
+			objects.clear();
+
+			// $$ warning collect objects takes only unmailed ones!
+			CollectObjects(box, objects);
+
+			//	cout<<"collected objects="<<objects.size()<<endl;
+			ObjectContainer::const_iterator noi = objects.begin();
+			for (; noi != objects.end(); ++ noi) 
+			{
+				Intersectable *o = *noi;
+				// $$ JB warning: pdfs are not correct at this point!	  
+				pvs.AddSampleDirty(o, Limits::Small);
+			}
+		}
+
+		stats.mAvgFilterRadius /= (stats.mLocalFilterCount + stats.mGlobalFilterCount);
+	}
+
+	Debug<<" nPvs size = "<<pvs.GetSize()<<endl;
+
+#if !USE_KD_PVS
+	// copy the base pvs to the new pvs
 	pit = basePvs.GetIterator();
-	
-	ObjectContainer objects;
-	
-	while (pit.HasMoreEntries())
-	  {		
+	while (pit.HasMoreEntries()) 
+	{		
 		ObjectPvsEntry entry = pit.Next();
-		
-		Intersectable *object = entry.mObject;
-		// compute filter size based on the distance and the numebr of samples
-		AxisAlignedBox3 box = object->GetBox();
-		
-		float distance = Distance(center, box.Center());
-		float globalRadius = distance*globalC;
-		
-		int objectSamples = (int)entry.mData.mSumPdf;
-		float localRadius = MAX_FLOAT;
-		if (objectSamples > MIN_LOCAL_SAMPLES)
-		  localRadius = filterSize*0.5f*Magnitude(box.Diagonal())/
-			sqrt((float)objectSamples);
-		
-		//	cout<<"lr="<<localRadius<<" gr="<<globalRadius<<endl;
-		
-		// now compute the filter size
-		float radius;
-
-		if (localRadius < globalRadius) {
-		  radius = localRadius;
-		  stats.mLocalFilterCount++;
-		} else {
-		  radius = globalRadius;
-		  stats.mGlobalFilterCount++;
-		}
-
-		stats.mAvgFilterRadius += radius;
-		
-		// cout<<"box = "<<box<<endl;
-		//	cout<<"distance = "<<distance<<endl;
-		//	cout<<"radiues = "<<radius<<endl;
-		
-		box.Enlarge(Vector3(radius));
-		
-		objects.clear();
-		// $$ warning collect objects takes only unmailed ones!
-		CollectObjects(box, objects);
-		//	cout<<"collected objects="<<objects.size()<<endl;
-		ObjectContainer::const_iterator noi = objects.begin();
-		for (; noi != objects.end(); ++ noi) {
-		  Intersectable *o = *noi;
-		  // $$ JB warning: pdfs are not correct at this point!	  
-		  pvs.AddSampleDirty(o, Limits::Small);
-		}
-	  }
-	stats.mAvgFilterRadius /= (stats.mLocalFilterCount + stats.mGlobalFilterCount);
-  }
-  
-  Debug<<" nPvs size = "<<pvs.GetSize()<<endl;
-
-#if !USE_KD_PVS
-  // copy the base pvs to the new pvs
-  pit = basePvs.GetIterator();
-  while (pit.HasMoreEntries()) {		
-	ObjectPvsEntry entry = pit.Next();
-	pvs.AddSampleDirty(entry.mObject, entry.mData.mSumPdf);
-  }
+		pvs.AddSampleDirty(entry.mObject, entry.mData.mSumPdf);
+	}
 #endif
-  viewCell->SetFilteredPvsSize(pvs.GetSize());
-  
-  Intersectable::NewMail();
-  return stats;
+	viewCell->SetFilteredPvsSize(pvs.GetSize());
+
+	Intersectable::NewMail();
+	
+	return stats;
 }
 #endif
 
-  
+
 
 void ViewCellsManager::ExportColor(Exporter *exporter, 
@@ -6227,5 +6269,5 @@
 
 #if 0
-			////////////////////////////
+			//////////////
 			// filtered stats
 			sprintf(suffix, "-%09d-eval-filter.log", castSamples);
@@ -6242,6 +6284,5 @@
 			cout << "finished in " << timeDiff * 1e-3 << " secs" << endl;
 			cout << "*************************************" << endl;
-
-			Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl;
+			Debug << "filtered statistics computed in " << timeDiff * 1e-3 << " secs" << endl;
 #endif
 
@@ -6260,5 +6301,6 @@
 				}
 
-				cout << "debug entries: " << pvsSize << ", memcost: " << (float)pvsSize * ObjectPvs::GetEntrySize() << endl;
+				cout << "debug entries: " << pvsSize << ", memcost: " 
+					 << (float)pvsSize * ObjectPvs::GetEntrySize() << endl;
 			}
 		}
@@ -6271,58 +6313,4 @@
 
 
-LocalMergeTree::LocalMergeTree(const ViewCellContainer &viewCells):
-mViewCells(viewCells)
-{
-	mRoot = Subdivide(0, (int)mViewCells.size());
-}
-
-
-void LocalMergeTree::Merge(ObjectPvs &mergedPvs)
-{
-	Merge(mRoot, mergedPvs);
-}
-
-
-void LocalMergeTree::Merge(LocalMergeNode *node, ObjectPvs &mergedPvs)
-{
-	////////////////
-	//-- pvs is not stored with the interiors => reconstruct
-	if (node->IsLeaf())
-	{
-		LocalMergeLeaf *leaf = dynamic_cast<LocalMergeLeaf *>(node);
-        mergedPvs = leaf->mViewCell->GetPvs();
-	}
-	else
-	{
-		LocalMergeInterior *interior = dynamic_cast<LocalMergeInterior *>(node);
-
-		ObjectPvs leftPvs, rightPvs;
-
-		Merge(interior->mLeft, leftPvs);
-		Merge(interior->mRight, rightPvs);
-
-		ObjectPvs::Merge(mergedPvs, leftPvs, rightPvs);
-	}	
-}
-
-
-LocalMergeNode *LocalMergeTree::Subdivide(const int leftIdx, const int rightIdx)
-{
-	if (leftIdx == rightIdx)
-	{
-		return new LocalMergeLeaf(mViewCells[leftIdx]);
-	}
-
-	LocalMergeInterior *interior = new LocalMergeInterior();
-
-	const int midSplit = (leftIdx + rightIdx) / 2;
-
-	interior->mLeft = Subdivide(leftIdx, midSplit);
-	interior->mRight = Subdivide(midSplit,  rightIdx);
-
-	return interior;
-}
-
-
-
-}
+
+}
Index: GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp	(revision 1786)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp	(revision 1787)
@@ -1813,6 +1813,5 @@
 
 
-// TODO matt: implement this function for different storing methods
-void HierarchyManager::GetPvsIncrementally(ViewCell *vc, ObjectPvs &pvs) const
+void HierarchyManager::GetPvsEfficiently(ViewCell *viewCell, ObjectPvs &pvs) const
 {
 	////////////////
@@ -1821,9 +1820,11 @@
 	// add pvs from leaves
 	stack<ViewCell *> tstack;
-	tstack.push(vc);
+	tstack.push(viewCell);
+
+	Intersectable::NewMail();
 
 	while (!tstack.empty())
 	{
-		vc = tstack.top();
+		ViewCell *vc = tstack.top();
 		tstack.pop();
 	
@@ -1831,11 +1832,20 @@
 		if (!vc->GetPvs().Empty())
 		{
-			if (vc->IsLeaf()) cout << " l " << pvs.GetSize();
-			else cout << " i " << pvs.GetSize();
-			pvs.MergeInPlace(vc->GetPvs());
+			ObjectPvsIterator pit = vc->GetPvs().GetIterator();
+
+			while (pit.HasMoreEntries())
+			{		
+				const ObjectPvsEntry &entry = pit.Next();
+
+				Intersectable *object = entry.mObject;
+				if (!object->Mailed())
+				{
+					object->Mail();
+					pvs.AddSampleDirty(object, 1.0f);
+				}
+			}
 		}
 		else if (!vc->IsLeaf()) // interior cells: go down to leaf level
 		{
-			cout <<" t";
 			ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);
 			ViewCellContainer::const_iterator it, it_end = interior->mChildren.end();
@@ -1846,4 +1856,41 @@
 			}		
 		}
+	}
+}
+
+
+// TODO matt: implement this function for different storing methods
+void HierarchyManager::GetPvsIncrementially(ViewCell *vc, ObjectPvs &pvs) const
+{
+	////////////////
+	//-- pvs is not stored with the interiors => reconstruct
+	
+	// add pvs from leaves
+	stack<ViewCell *> tstack;
+	tstack.push(vc);
+
+	while (!tstack.empty())
+	{
+		vc = tstack.top();
+		tstack.pop();
+	
+		// add newly found pvs to merged pvs: break here even for interior
+		if (!vc->GetPvs().Empty())
+		{
+			//if (vc->IsLeaf()) cout << " l " << pvs.GetSize();
+			//else cout << " i " << pvs.GetSize();
+			pvs.MergeInPlace(vc->GetPvs());
+		}
+		else if (!vc->IsLeaf()) // interior cells: go down to leaf level
+		{
+			//cout <<" t";
+			ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc);
+			ViewCellContainer::const_iterator it, it_end = interior->mChildren.end();
+
+			for (it = interior->mChildren.begin(); it != it_end; ++ it)
+			{
+				tstack.push(*it);
+			}		
+		}
 		else cout <<"k";
 	}
@@ -1875,9 +1922,5 @@
 		if (!vc->GetPvs().Empty())
 		{
-			/*if (vc->IsLeaf()) 
-				cout << " l " << viewCell->GetPvs().GetSize();
-			else cout << " i " << viewCell->GetPvs().GetSize();
-			*/
-				viewCell->GetPvs().MergeInPlace(vc->GetPvs());
+			viewCell->GetPvs().MergeInPlace(vc->GetPvs());
 		}
 		else if (!vc->IsLeaf()) // interior cells: go down to leaf level
@@ -1963,21 +2006,29 @@
 	ViewCell::NewMail();
 
-	cout << "\n**************viewcells: " << viewCells.size() << endl;
+	//cout << "\nviewcells: " << viewCells.size() << endl;
 	for (vit = viewCells.begin(); vit != vit_end; ++ vit)
 	{
 		ViewCell *vc = *vit;
-
-		//cout << "\nhere5: ";
 		float rc = 0;
         
 #if STUPID_METHOD	
 		ObjectPvs pvs;
-		GetPvsIncrementally(vc, pvs);
+		GetPvsIncrementially(vc, pvs);
 		vc->SetPvs(pvs);
+		
 #else
-		//PullUpPvsIncrementally(vc);
+	
 		ObjectPvs pvs;
-		GetPvsRecursive(vc, pvs);
-		vc->SetPvs(pvs);
+		//GetPvsRecursive(vc, pvs);
+		
+		// uses mailing
+		// warning: pvs not sorted!!
+		if (vc->GetPvs().Empty())
+		{
+			GetPvsEfficiently(vc, pvs);
+			vc->SetPvs(pvs);
+			//cout << "q";
+		}
+		//else cout << "t";
 #endif
 
@@ -1991,5 +2042,5 @@
 			const long endT = GetTime();
 
-			cout << "filter computed in " << TimeDiff(startT, endT) * 1e-3f << " secs" << endl;
+			//cout << "filter computed in " << TimeDiff(startT, endT) * 1e-3f << " secs" << endl;
 			ComputePvs(filteredPvs, rc, pvsEntries);
 		}
