Index: orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4616)
+++ orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4617)
@@ -9,5 +9,5 @@
    any later version.
 
-   ### File Specific:
+### File Specific:
    main-programmer: Patrick Boenzli
    co-programmer: ...
@@ -44,8 +44,8 @@
 /**
    \brief standard constructor
-*/
+ */
 OBBTreeNode::OBBTreeNode ()
 {
-   this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
+  this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
 
 }
@@ -54,6 +54,5 @@
 /**
    \brief standard deconstructor
-
-*/
+ */
 OBBTreeNode::~OBBTreeNode ()
 {
@@ -67,13 +66,14 @@
    \param depth: how much more depth-steps to go: if == 1 don't go any deeper!
    \param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle
-*/
+ */
 void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
 {
   this->depth = depth;
 
+  this->bvElement = this->createBox();
+  this->calculateBoxAttributes(this->bvElement, verticesList, length);
+
   if( likely( this->depth > 0))
   {
-    this->bvElement = this->createBox();
-    this->calculateBoxAttributes(this->bvElement, verticesList, length);
     this->forkBox(this->bvElement);
   }
@@ -105,21 +105,21 @@
   /* fist compute all the convex hull face/facelets and centroids */
   for(int i = 0; i < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
-    {
-      p = verticesList[i];
-      q = verticesList[i +1];
-      r = verticesList[i + 2];
-
-      t1 = p - q; t2 = p - r;
-
-      /* finding the facelet surface via cross-product */
-      facelet[i] = 0.5f * fabs( t1.cross(t2).len() );
-      /* update the entire convex hull surface */
-      face += facelet[i];
-
-      /* calculate the cetroid of the hull triangles */
-      centroid[i] = (p + q + r) * 1/3;
-      /* now calculate the centroid of the entire convex hull, weighted average of triangle centroids */
-      center += centroid[i] * facelet[i];
-    }
+  {
+    p = verticesList[i];
+    q = verticesList[i +1];
+    r = verticesList[i + 2];
+
+    t1 = p - q; t2 = p - r;
+
+    /* finding the facelet surface via cross-product */
+    facelet[i] = 0.5f * fabs( t1.cross(t2).len() );
+    /* update the entire convex hull surface */
+    face += facelet[i];
+
+    /* calculate the cetroid of the hull triangles */
+    centroid[i] = (p + q + r) * 1/3;
+    /* now calculate the centroid of the entire convex hull, weighted average of triangle centroids */
+    center += centroid[i] * facelet[i];
+  }
   /* take the average of the centroid sum */
   center /= face;
@@ -129,53 +129,53 @@
   /* now calculate the covariance matrix - if not written in three for-loops, it would compute faster: minor */
   for(int j = 0; j < 3; ++j)
+  {
+    for(int k = 0; k < 3; ++k)
     {
-      for(int k = 0; k < 3; ++k)
-        {
-          for(int i = 0; i < length; i+=3)
-            {
-              p = verticesList[i];
-              q = verticesList[i +1];
-              r = verticesList[i + 2];
-
-              covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j]* p[k] +
-                                                                q[j] * q[k] + r[j]*r[k]) - center[j] * center[k];
-            }
-        }
+      for(int i = 0; i < length; i+=3)
+      {
+        p = verticesList[i];
+        q = verticesList[i +1];
+        r = verticesList[i + 2];
+
+        covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j]* p[k] +
+            q[j] * q[k] + r[j]*r[k]) - center[j] * center[k];
+      }
     }
-
-    printf("\nVertex Data:\n");
-    for(int i = 0; i < length; i++)
-    {
-      printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
-    }
+  }
+
+  printf("\nVertex Data:\n");
+  for(int i = 0; i < length; i++)
+  {
+    printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
+  }
 
   printf("\nCovariance Matrix:\n");
   for(int j = 0; j < 3; ++j)
+  {
+    printf(" |");
+    for(int k = 0; k < 3; ++k)
     {
-      printf(" |");
-      for(int k = 0; k < 3; ++k)
-        {
-          printf(" \b%f ", covariance[j][k]);
-        }
-      printf(" |\n");
+      printf(" \b%f ", covariance[j][k]);
     }
+    printf(" |\n");
+  }
   printf("center: %f, %f, %f\n\n", center.x, center.y, center.z);
 
 
   for(int i = 0; i < 3; ++i)
-    {
-
-      box->covarianceMatrix[i][0] = covariance[i][0];
-      box->covarianceMatrix[i][1] = covariance[i][1];
-      box->covarianceMatrix[i][3] = covariance[i][2];
-    }
+  {
+
+    box->covarianceMatrix[i][0] = covariance[i][0];
+    box->covarianceMatrix[i][1] = covariance[i][1];
+    box->covarianceMatrix[i][3] = covariance[i][2];
+  }
   *box->center = center;
 
 
   /* now getting spanning vectors of the sub-space:
-     the eigenvectors of a symmertric matrix, such as the
-     covarience matrix are mutually orthogonal.
-     after normalizing them, they can be used as a the basis
-     vectors
+  the eigenvectors of a symmertric matrix, such as the
+  covarience matrix are mutually orthogonal.
+  after normalizing them, they can be used as a the basis
+  vectors
   */
   Matrix                V(3,3);                               //!< for eigenvectors
@@ -304,5 +304,5 @@
 
   /* now definin the separation plane through this specified nearest point and partition
-    the points depending on which side they are located
+  the points depending on which side they are located
   */
   Plane              separationPlane(*box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
@@ -379,6 +379,6 @@
   this->nodeRight = node2;
 
-  this->nodeLeft->spawnBVTree(this->depth - 1, vertList1, partition1.getSize());
-  this->nodeRight->spawnBVTree(this->depth - 1, vertList2, partition2.getSize());
+  this->nodeLeft->spawnBVTree(depth - 1, vertList1, partition1.getSize());
+  this->nodeRight->spawnBVTree(depth - 1, vertList2, partition2.getSize());
 }
 
@@ -398,4 +398,5 @@
 //     }
 //   glEnd();
+  //this->drawBVPolygon(currentDepth, depth);
 }
 
@@ -509,9 +510,9 @@
 /*
   glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
-             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
-             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
+  cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
+  cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
   glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
-             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
-             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);*/
+  cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
+  cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);*/
 
 
@@ -531,7 +532,7 @@
   /*
   for(int i = 0; i < length; i++)
-    {
-      printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
-    }
+  {
+  printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
+}
   */
 }
Index: orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
===================================================================
--- orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4616)
+++ orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4617)
@@ -31,9 +31,9 @@
 {
   CDEngine::getInstance();
-  //CDEngine::getInstance()->debug();
+  CDEngine::getInstance()->debug();
 
-  model = new MD2Model("models/tris.md2", "models/tris.pcx");
-  model->tick(0.1f);
-  CDEngine::getInstance()->debugSpawnTree(1, model->data->pVertices, model->data->numVertices);
+  //model = new MD2Model("models/tris.md2", "models/tris.pcx");
+  //model->tick(0.1f);
+  //CDEngine::getInstance()->debugSpawnTree(2, model->data->pVertices, model->data->numVertices);
 
   LightManager* lightMan = LightManager::getInstance();
@@ -70,5 +70,5 @@
   LightManager::getInstance()->draw();
 
-  model->draw();
+  //model->draw();
 }
 
@@ -84,13 +84,13 @@
 void Framework::moduleInitGui(int argc, char** argv)
 {
-  Window* guiMainWindow = NULL;
-
-  initGUI(0, NULL);
-
-  guiMainWindow = new Window("Collision_detection");
-  {
-    // all the Widgets you need
-  }
-  Window::mainWindow->showall();
-  Window::mainWindow->setSize(300, 500);
+//   Window* guiMainWindow = NULL;
+//
+//   initGUI(0, NULL);
+//
+//   guiMainWindow = new Window("Collision_detection");
+//   {
+//     // all the Widgets you need
+//   }
+//   Window::mainWindow->showall();
+//   Window::mainWindow->setSize(300, 500);
 }
