Index: orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc	(revision 4869)
+++ orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc	(revision 4887)
@@ -57,7 +57,7 @@
  *  gives the signal to separate the model into a quadtree
  */
-void Quadtree::separate(int treeDepth)
+void Quadtree::separate(const int maxDepth)
 {
-  this->rootNode->separateNode(treeDepth);
+  this->rootNode->separateNode(0, maxDepth);
 }
 
Index: orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h
===================================================================
--- orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 4869)
+++ orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 4887)
@@ -22,5 +22,5 @@
 
   void separate();
-  void separate(int treeDepth);
+  void separate(const int maxDepth);
   void separate(float minLength);
 
Index: orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 4869)
+++ orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 4887)
@@ -27,6 +27,6 @@
  *  standard constructor
 */
-QuadtreeNode::QuadtreeNode (sTriangleExt** triangles, int numTriangles, 
-			    const float* pVertices, int numVertices, Quadtree* quadtree)
+QuadtreeNode::QuadtreeNode (sTriangleExt** triangles, int numTriangles,
+                            const float* pVertices, int numVertices, Quadtree* quadtree)
 {
   this->pTriangles = triangles;
@@ -35,6 +35,7 @@
   this->numVertices = numVertices;
   this->quadtree = quadtree;
-  
-  this->pDimension = this->getDimension();
+  this->treeDepth = 0;
+
+//   this->pDimension = this->getDimension();
   this->init();
 }
@@ -47,5 +48,5 @@
 {
   this->pModelInfo = pModelInfo;
-  
+
   /* create an array of triangle references */
   this->pTriangles = new sTriangleExt*[this->pModelInfo->numTriangles];
@@ -55,6 +56,7 @@
   for( int i = 0; i < this->pModelInfo->numTriangles; ++i)
     this->pTriangles[i] = &this->pModelInfo->pTriangles[i];
-
-  this->pDimension = this->getDimension(this->pModelInfo);
+  this->treeDepth = 0;
+
+//   this->pDimension = this->getDimension(this->pModelInfo);
   this->init();
 }
@@ -75,5 +77,5 @@
 }
 
- 
+
 /**
  *  standard deconstructor
@@ -96,15 +98,22 @@
  * @param treeDepth the max depth, the steps to go if treeDept == 0 leaf reached
  */
-void QuadtreeNode::separateNode(int treeDepth)
-{
-  if( treeDepth <= 0)
+void QuadtreeNode::separateNode(int treeDepth, const int maxDepth)
+{
+  for( int i = 0; i < treeDepth; ++i)
+    PRINT(3)("  ");
+  PRINT(3)("   +-| (Event) Separating Node Depth: %i/%i\n", treeDepth, maxDepth);
+
+  this->pDimension = this->getDimension();
+
+  this->treeDepth = treeDepth;
+  if( treeDepth >= maxDepth)
     return;
-  PRINTF(0)("separate Node Nr: %i\n", treeDepth);
+
   this->separateNode();
 
-  this->nodeA->separateNode(treeDepth - 1);
-  this->nodeB->separateNode(treeDepth - 1);
-  this->nodeC->separateNode(treeDepth - 1);
-  this->nodeD->separateNode(treeDepth - 1);
+  this->nodeA->separateNode(treeDepth + 1, maxDepth);
+  this->nodeB->separateNode(treeDepth + 1, maxDepth);
+  this->nodeC->separateNode(treeDepth + 1, maxDepth);
+  this->nodeD->separateNode(treeDepth + 1, maxDepth);
 }
 
@@ -116,6 +125,9 @@
 void QuadtreeNode::separateNode(float minLength)
 {
+  this->pDimension = this->getDimension();
+
   if( minLength <= this->pDimension->getAxis())
     return;
+
   this->separateNode();
 
@@ -133,6 +145,4 @@
 void QuadtreeNode::separateNode()
 {
-  PRINTF(0)("got command to separate node\n");
-
   tList<sTriangleExt*>*           listA = new tList<sTriangleExt*>();    //!< triangle list of nodeA
   tList<sTriangleExt*>*           listB = new tList<sTriangleExt*>();    //!< triangle list of nodeB
@@ -146,19 +156,20 @@
     {
       for( int j = 0; j < 3; ++j)
-	{
-	  pVert = &this->pVertices[this->pTriangles[i]->indexToVertices[j]];
-	  if( pVert[0] > rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
-	    listA->add(&this->pTriangles[i]);
-	  if( pVert[0] > rectCenter->x + this->offset && pVert[2]< rectCenter->z + this->offset) 
-	    listB->add(&this->pTriangles[i]);
-	  if( pVert[0] < rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
-	    listC->add(&this->pTriangles[i]);
-	  if( pVert[0] < rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
-	    listD->add(&this->pTriangles[i]);
-	}
-    }
-  printf("Temp. list Num. o El: A: %i, B: %i, C: %i, D: %i\n", listA->getSize(), listB->getSize(), listC->getSize(), listD->getSize());
-
-  
+        {
+          pVert = &this->pVertices[this->pTriangles[i]->indexToVertices[j]];
+          if( pVert[0] > rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
+            listA->add(&this->pTriangles[i]);
+          if( pVert[0] > rectCenter->x + this->offset && pVert[2]< rectCenter->z + this->offset)
+            listB->add(&this->pTriangles[i]);
+          if( pVert[0] < rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
+            listC->add(&this->pTriangles[i]);
+          if( pVert[0] < rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
+            listD->add(&this->pTriangles[i]);
+        }
+    }
+    for( int i = 0; i < treeDepth; ++i)
+      PRINT(3)("  ");
+    PRINT(3)("   +-| (II) Quadtree Counts: A: %i, B: %i, C: %i, D: %i\n", listA->getSize(), listB->getSize(), listC->getSize(), listD->getSize());
+
   /* Separating into to the triangle lists  */
   sTriangleExt**                 pTriA;                                 //!< Triangle array A
@@ -178,8 +189,8 @@
   lenC = listC->getSize();
   lenD = listD->getSize();
-  
+
   pTriA = new sTriangleExt*[listA->getSize()];
   pTriB = new sTriangleExt*[listB->getSize()];
-  pTriC = new sTriangleExt*[listC->getSize()];  
+  pTriC = new sTriangleExt*[listC->getSize()];
   pTriD = new sTriangleExt*[listD->getSize()];
 
@@ -204,5 +215,5 @@
       ++counter;
     }
-  
+
   counter = 0;
   iterator = listC->getIterator();
@@ -237,7 +248,4 @@
   this->nodeC = new QuadtreeNode(pTriC, lenC, this->pVertices, this->numVertices, this->quadtree);
   this->nodeD = new QuadtreeNode(pTriD, lenD, this->pVertices, this->numVertices, this->quadtree);
-
-
-  PRINTF(0)("separation complete\n");
 }
 
@@ -300,6 +308,7 @@
   rect->setAxis(fmax(((fabs(maxX) + fabs(minX)) / 2.0f), ((fabs(maxY) + fabs(minY)) / 2.0f)));
 
-  PRINTF(0)("Dimension Informationation: X: min/max %f/%f Y: min/max %f/%f\n", minX, maxX, minY, maxY);
-  PRINTF(0)("Center: %f, %f, %f   Axis: %f\n", rect->getCenter()->x, rect->getCenter()->y, rect->getCenter()->z, rect->getAxis());
+  for( int i = 0; i < this->treeDepth; ++i)
+    PRINT(3)("  ");
+  PRINT(3)("   +-| (II) Rectangle Dimension  (%f, %f) to (%f, %f), Center (%f, %f)\n", minX, minY, maxX, maxY, rect->getCenter()->x, rect->getCenter()->z, rect->getAxis());
   return rect;
 }
@@ -309,5 +318,5 @@
    \brief gets the maximal dimension of a model
    \return the dimension of the AbstractModel as a Rectangle
-   
+
    The rectangle is x-z axis aligned. ATTENTION: if there are any vertices in the model, that exceed the
    size of 999999.0, there probably will be some errors in the dimensions calculations. Write an email to
@@ -320,20 +329,24 @@
   float            minX, minY;                       //!< minimal axis coorindates
   const float*     pVertices;                        //!< pointer to the current vertices
-  
+
   maxX = -999999; maxY = -999999;
   minX =  999999; minY =  999999;
   /* get maximal/minimal x/y */
-  for( int i = 0; i < this->numVertices; ++i)
+  for( int i = 0; i < this->numTriangles; ++i)
   {
-    pVertices = &this->pVertices[i * 3];
-    if( pVertices[0] > maxX)
-      maxX = pVertices[0];
-    if( pVertices[2] > maxY)
-      maxY = pVertices[2];
-
-    if( pVertices[0] < minX)
-      minX = pVertices[0];
-    if( pVertices[2] < minY)
-      minY = pVertices[2];
+    for( int j = 0; j < 3; ++j)
+    {
+
+      pVertices = &this->pVertices[this->pTriangles[i]->indexToVertices[j]];
+      if( pVertices[0] > maxX)
+        maxX = pVertices[0];
+      if( pVertices[2] > maxY)
+        maxY = pVertices[2];
+
+      if( pVertices[0] < minX)
+        minX = pVertices[0];
+      if( pVertices[2] < minY)
+        minY = pVertices[2];
+    }
   }
 
@@ -342,6 +355,7 @@
   rect->setAxis(fmax(((fabs(maxX) + fabs(minX)) / 2.0f), ((fabs(maxY) + fabs(minY)) / 2.0f)));
 
-  PRINTF(0)("Dimension Informationation: X: min/max %f/%f Y: min/max %f/%f\n", minX, maxX, minY, maxY);
-  PRINTF(0)("Center: %f, %f, %f   Axis: %f\n", rect->getCenter()->x, rect->getCenter()->y, rect->getCenter()->z, rect->getAxis());
+  for( int i = 0; i < this->treeDepth; ++i)
+    PRINT(3)("  ");
+  PRINT(3)("   +-| (II) Rectangle Dimension  (%f, %f) to (%f, %f), Center (%f, %f)\n", minX, minY, maxX, maxY, rect->getCenter()->x, rect->getCenter()->z, rect->getAxis());
   return rect;
 }
Index: orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h
===================================================================
--- orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 4869)
+++ orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 4887)
@@ -20,10 +20,10 @@
 
   public:
-    QuadtreeNode(sTriangleExt** triangles, int numTriangles, 
-		 const float* pVertices, int numVertices, Quadtree* quadtree);
+    QuadtreeNode(sTriangleExt** triangles, int numTriangles,
+                 const float* pVertices, int numVertices, Quadtree* quadtree);
     QuadtreeNode(modelInfo* pModelInfo);
     virtual ~QuadtreeNode();
 
-    void separateNode(int treeDepth);
+    void separateNode(int treeDepth, const int maxDepth);
     void separateNode(float minLength);
     void separateNode();
@@ -44,4 +44,6 @@
     float                           offset;             //!< offset of the actual quadtree rectangle
 
+    int                             treeDepth;          //!< the depth of the tree
+
     sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
     const float*                    pVertices;          //!< reference to vertices data
Index: orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 4869)
+++ orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 4887)
@@ -33,5 +33,8 @@
 SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize)
 {
-  PRINTF(0)("Spatial Separation process kicked on\n");
+  PRINT(3)("\n");
+  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
+  PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
+
    this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
    /* debug vice */
