Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1414)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1416)
@@ -151,7 +151,7 @@
     */
     virtual bool LoadViewCellsGeometry(const string filename);
-
-	
-	/** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector.
+	
+	/** Constructs view cell from base triangle. 
+		The view cell is extruded along the normal vector.
 		@param the base triangle
 		@param the height of the newly created view cell
@@ -347,15 +347,16 @@
 	*/
 	int GetMinPvsSize() const;
-
 	/** Returns maximal ratio. i.e., currentPVs / maxPvs,
 		where pvs is still considered valid.
 	*/
 	float GetMaxPvsRatio() const;
-
 	/** Exports view cell geometry.
 	*/
-	virtual void ExportViewCellGeometry(Exporter *exporter, 
-										ViewCell *vc,
-										const AxisAlignedPlane *clipPlane = NULL) const = 0;
+	virtual	void ExportViewCellGeometry(
+		Exporter *exporter,
+		ViewCell *vc,
+		const AxisAlignedBox3 *box,
+		const AxisAlignedPlane *clipPlane = NULL
+		) const = 0;
 
 	/** Brings the view cells into their final state, computes meshes and volume.
@@ -483,4 +484,5 @@
 	//////////////////////////////////////////////////////////////////
 
+
 	/** Returns true if the view cell is equivalent to a 
 		node of the spatial hierarchy. This function can be used for merged
@@ -553,26 +555,34 @@
 	void EvaluateViewCellsStats();
 
+
+	///////////////////////
 	//-- helper functions for view cell visualization
 
 	/** Exports the view cell partition.
 	*/
-	void ExportViewCellsForViz(Exporter *exporter) const;
+	void ExportViewCellsForViz(
+		Exporter *exporter, 
+		const AxisAlignedBox3 *box,
+		const AxisAlignedPlane *clipPlane = NULL) const;
 
 	/** Sets exporter color.
 	*/
 	virtual void ExportColor(Exporter *exporter, ViewCell *vc) const;
+	/** Creates meshes from the view cells.
+	*/
+	void CreateViewCellMeshes();
+	/** Creates clip plane for visualization.
+	*/
+	void CreateClipPlane();
+
+	AxisAlignedPlane *GetClipPlane();
+	///////////////////////
 
 	/** Returns volume of the view space.
 	*/
 	virtual float GetViewSpaceVolume();
-	
-	/** Creates meshes from the view cells.
-	*/
-	void CreateViewCellMeshes();
-
-	/** Takes different measures to prepares the view cells after loading them from disc.
+	/** Prepares the view cells for sampling after loading them from disc.
 	*/
 	virtual void PrepareLoadedViewCells() {};
-
 	/** Constructs local view cell merge hierarchy.
 	*/
@@ -586,8 +596,4 @@
 									   const ViewCellContainer &viewCells);
   
-	/** Creates clip plane for visualization.
-	*/
-	void CreateClipPlane();
-
 	/** Updates pvs of all view cells for statistical evaluation after some more sampling
 	*/
@@ -600,25 +606,22 @@
 	/// if bounding boxes should be exported together with the view cells
 	bool mExportBboxesForPvs;
-		
-	//Environment *environment;
-	AxisAlignedPlane mClipPlane;
-
+	/// the clip plane for visualization
+	AxisAlignedPlane mClipPlaneForViz;
+	/// if the visualization is using the clip plane
 	bool mUseClipPlaneForViz;
-
-
 	/// Renders the view cells.
 	Renderer *mRenderer;
-
 	/// Loaded view cells
 	ViewCellContainer mViewCells;
-	/// the corresponding view cell tree holding the logical description of view cells
+	/// the view cell hierarchy (i.e., the logical description of view cells)
 	ViewCellsTree *mViewCellsTree;
 	
-	/// if the values in the view cell leaves and the interiors are up to date
-	/// this is meant for lazy storing of the pvs, where only a scalar indicating
-	/// pvs size is stored in interiors and not the pvs itself.
+	/** if the values in the view cell leaves and the interiors are up to date
+		this is meant for lazy storing of the pvs, where only a scalar indicating
+		pvs size is stored in interiors and not the pvs itself.
+	*/
 	bool mViewCellPvsIsUpdated;
 
-	/// maximum number of samples taken for construction of the view cells
+	/// maximum number of samples for the view cell construction
 	int mConstructionSamples;
 	int mSamplesPerPass;
@@ -732,7 +735,9 @@
 	void CreateMesh(ViewCell *vc);
 
-	void ExportViewCellGeometry(Exporter *exporter, 
-								ViewCell *vc, 
-								const AxisAlignedPlane *clipPlane = NULL) const;
+	void ExportViewCellGeometry(Exporter *exporter,
+								ViewCell *vc,
+								const AxisAlignedBox3 *box,
+								const AxisAlignedPlane *clipPlane = NULL
+								) const;
 	
 	void CollectMergeCandidates(const VssRayContainer &rays, 
@@ -741,5 +746,7 @@
 	void Finalize(ViewCell *viewCell, const bool createMesh);
 
-	bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects);
+	bool ExportViewCells(const string filename, 
+						 const bool exportPvs, 
+						 const ObjectContainer &objects);
 
 	/** Constructs merge hierarchy which corresponds to the spatial hierarchy.
@@ -805,14 +812,18 @@
 	*/
 	//  virtual void PrintStatistics(ostream &s) const;
-	ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const { return NULL; }
+	ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const 
+	{ return NULL; }
 
 	float GetProbability(ViewCell *viewCell);
 	
-
 	void CreateMesh(ViewCell *vc);
 
-	void ExportViewCellGeometry(Exporter *exporter, 
-								ViewCell *vc,
-								const AxisAlignedPlane *clipPlane = NULL) const;
+	void ExportViewCellGeometry(
+		Exporter *exporter,
+		ViewCell *vc,
+		const AxisAlignedBox3 *box,
+		const AxisAlignedPlane *clipPlane = NULL
+		) const;
+
 
 	void CollectMergeCandidates(const VssRayContainer &rays, 
@@ -879,13 +890,18 @@
 	void CreateMesh(ViewCell *vc);
 
-	bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects);
+	bool ExportViewCells(
+		const string filename, 
+		const bool exportPvs, 
+		const ObjectContainer &objects);
 
 	int CastBeam(Beam &beam);
-
-	void ExportViewCellGeometry(Exporter *exporter, 
-								ViewCell *vc,
-								const AxisAlignedPlane *clipPlane = NULL) const;
-
-	//float GetVolume(ViewCell *viewCell) const;
+	
+	void ExportViewCellGeometry(
+		Exporter *exporter,
+		ViewCell *vc,
+		const AxisAlignedBox3 *box,
+		const AxisAlignedPlane *clipPlane = NULL
+		) const;
+
 
 	void Finalize(ViewCell *viewCell, const bool createMesh);
@@ -920,5 +936,4 @@
 	*/
 	int GetMaxTreeDiff(ViewCell *vc) const;
-	
 
 	/** Prepare view cells for use after loading them from disc.
@@ -1039,15 +1054,19 @@
 	virtual void EvalViewCellPartition();
 #endif
+
 	/** Exports view cell geometry.
 	*/
-	void ExportViewCellGeometry(Exporter *exporter, 
+	void ExportViewCellGeometry(
+		Exporter *exporter,
 		ViewCell *vc,
-		const AxisAlignedPlane *clipPlane = NULL) const;
-
-	int ComputeBoxIntersections(const AxisAlignedBox3 &box, 
+		const AxisAlignedBox3 *box,
+		const AxisAlignedPlane *clipPlane = NULL
+		) const;
+
+	int ComputeBoxIntersections(
+		const AxisAlignedBox3 &box, 
 		ViewCellContainer &viewCells) const;
 	
 	void CollectViewCells();
-
 
 	/** Prepare view cells for use after loading them from disc.
@@ -1067,9 +1086,4 @@
 
 	/////////////////////////////////////////
-
-	/// the view space / object partition hierarchies
-	//VspTree *mVspTree;
-	//OspTree *mOspTree;
-	//BvHierarchy *mBvHierarchy;
 
 	HierarchyManager *mHierarchyManager;
