Index: trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp	(revision 530)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp	(revision 531)
@@ -75,12 +75,12 @@
 	const float yDirRange = mDirBox.Max().y - mDirBox.Min().y;
 
-	near = 0.1; // NOTE: what is the best value for near and far plane?
+	near = 0.1f; // NOTE: what is the best value for near and far plane?
 	far = 2.0f * Magnitude(sceneBBox.Diagonal());
 
-	left = near / tan(xDirRange * 0.5);
-	right = near / tan(xDirRange * 0.5);
+	left = near / tan(xDirRange * 0.5f);
+	right = near / tan(xDirRange * 0.5f);
 
-	bottom = near / tan(yDirRange * 0.5);
-	top = near / tan(yDirRange * 0.5);
+	bottom = near / tan(yDirRange * 0.5f);
+	top = near / tan(yDirRange * 0.5f);
 }
 
@@ -89,10 +89,35 @@
 	 Vector3 directions[4];
 	 
-	 directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y);
-	 directions[1] = VssRay::GetDirection(dBox.Max().x, dBox.Min().y);
-	 directions[2] = VssRay::GetDirection(dBox.Max().x, dBox.Max().y);
-	 directions[3] = VssRay::GetDirection(dBox.Min().x, dBox.Max().y);
+	 directions[0] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Min().y);
+	 directions[1] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Min().y);
+	 directions[2] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Max().y);
+	 directions[3] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Max().y);
 
 	const Vector3 mainDir = directions[0] + directions[1] + directions[2] + directions[3];
 	return Normalize(mainDir);
 }
+
+
+void BeamSampleStatistics::Print(ostream &app) const
+{
+  app << "===== Beam sample statistics ===============\n";
+
+  app << "#N_PVSSIZE ( size of pvs )\n" << pvsSize << "\n";
+
+  app << "#N_RAYS ( Number of rays )\n" << rays << "\n";
+
+  app << "#N_RAYCONTRIBUTIONS ( number of ray constributions )\n" <<
+    rayContributions << "\n";
+
+  app << "#N_RAYLENGHTENTROPY  ( Ray lenght entropy )\n" <<
+    rayLengthEntropy << "\n";
+
+  app << "#N_IMPORTANCE  ( importance )\n" <<
+    importance << "\n";
+
+  app << "#N_CTIME  ( Construction time [s] )\n"
+      << Time() << " \n";
+
+  app << "===== END OF KdTree statistics ==========\n";
+
+}
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Beam.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Beam.h	(revision 525)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Beam.h	(revision 531)
@@ -4,4 +4,5 @@
 #include <vector>
 #include "AxisAlignedBox3.h"
+#include "Statistics.h"
 
 using namespace std;
@@ -10,4 +11,46 @@
 class Intersectable;
 
+// the values need for rss tree update computed already inside the glrendererbuffer
+// not all of them need to be computed
+class BeamSampleStatistics: public StatisticsBase
+{
+public:
+	enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY};
+	int flags;
+
+	BeamSampleStatistics(): flags(COMPUTE_RAY_CONTRIBUTIONS) 
+	{
+		Reset();
+	}
+	
+	float pvsSize;
+	float rays;
+	float rayContributions;
+	float pvsEntropy;
+	float rayLengthEntropy;
+	float importance;
+	
+	float weightedRayContribution;
+
+	void Reset() 
+	{
+		pvsSize = 0;
+		rays = 0;
+		rayContributions = 0;
+		pvsEntropy = 0;
+		rayLengthEntropy = 0;
+		importance = 0;
+	}
+
+	void Print(ostream &app) const;
+
+	friend ostream &operator<<(ostream &s, const BeamSampleStatistics &stat) 
+	{
+		stat.Print(s);
+		return s;
+	}  
+};
+
+  
 class Beam {
   
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp	(revision 530)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp	(revision 531)
@@ -11,4 +11,6 @@
 #include "ViewCellsManager.h"
 #include "RenderSimulator.h"
+#include "Beam.h"
+#include "GlRenderer.h"
 
 bool use2dSampling = false;
@@ -347,25 +349,25 @@
 
 
-void VssPreprocess::VerifyBeamCasting()
-{
-
-	vector<VssLeaf *> leaves;
-	mVssTree->CollectLeaves(leaves);
+void VssPreprocessor::TestBeamCasting(VssTree *tree)
+{
+
+	vector<VssTreeLeaf *> leaves;
+	tree->CollectLeaves(leaves);
 
 	for (int i = 0; i < 10; ++i)
 	{
-		const int index = (int)RandomValue(0, (Real)((int)leaf.size() - 1));
-		VssLeaf *leaf = leaves[index];
+		const int index = (int)RandomValue(0, (Real)((int)leaves.size() - 1));
+		VssTreeLeaf *leaf = leaves[index];
 
 		Beam beam;
-		AxisAlignedBox3 dirBox = mVssTree->GetDirBBox(leaf);
-		AxisAlignedBox3 box = mVssTree->GetBBox(leaf);
+		AxisAlignedBox3 dirBox =tree->GetDirBBox(leaf);
+		AxisAlignedBox3 box = tree->GetBBox(leaf);
 		beam.Construct(dirBox, box);
 		Intersectable *sourceObj = mObjects[5];
 		BeamSampleStatistics stats;
-		mGlRenderer->SampleBeamContributions(sourceObj,
-											 beam,
-											 10000,
-											 stats);
+		renderer->SampleBeamContributions(sourceObj,
+										  beam,
+										  10000,
+										  stats);
 
 		Debug << "beam statistics: " << stats << endl;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h	(revision 525)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h	(revision 531)
@@ -19,4 +19,6 @@
 class Beam;
 
+class BeamSampleStatistics;
+
 struct PvsRenderStatistics {
   
@@ -136,25 +138,4 @@
 
 
-
-  // the values need for rss tree update computed already inside the glrendererbuffer
-  // not all of them need to be computed
-  struct BeamSampleStatistics {
-
-	enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY};
-	int flags;
-
-	BeamSampleStatistics():flags(COMPUTE_RAY_CONTRIBUTIONS) {}
-	
-	float pvsSize;
-	float rays;
-	float rayContributions;
-	float pvsEntropy;
-	float rayLengthEntropy;
-	float importance;
-	
-	float weightedRayContribution;
-  };
-  
-
   void SampleBeamContributions(
 							   Intersectable *sourceObject,
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h	(revision 530)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h	(revision 531)
@@ -105,5 +105,5 @@
   void CastRay(const BspTree &tree, const VssRay & vssRay);
 
-  float VerifyBeamCasting(Beam &beam);
+  void TestBeamCasting(VssTree *tree);
 };
 
