Index: /orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- /orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4631)
+++ /orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4632)
@@ -102,10 +102,11 @@
   this->bvElement = new OBB();
   PRINTF(0)("Created OBBox\n");
-  this->calculateBoxAttributes1(this->bvElement, verticesList, length);
+  this->calculateBoxCovariance(this->bvElement, verticesList, length);
   PRINTF(0)("Calculated attributes1\n");
-  this->calculateBoxAttributes2(this->bvElement, verticesList, length);
+  this->calculateBoxEigenvectors(this->bvElement, verticesList, length);
   PRINTF(0)("Calculated attributes2\n");
-  this->calculateBoxAttributes3(this->bvElement, verticesList, length);
+  this->calculateBoxAxis(this->bvElement, verticesList, length);
   PRINTF(0)("Calculated attributes3\n");
+
 
   if( likely( this->depth > 0))
@@ -127,5 +128,5 @@
 
 
-void OBBTreeNode::calculateBoxAttributes1(OBB* box, sVec3D* verticesList, int length)
+void OBBTreeNode::calculateBoxCovariance(OBB* box, sVec3D* verticesList, int length)
 {
   float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
@@ -218,5 +219,5 @@
 
 
-void OBBTreeNode::calculateBoxAttributes2(OBB* box, sVec3D* verticesList, int length)
+void OBBTreeNode::calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length)
 {
 
@@ -228,12 +229,4 @@
   */
   Vector**              axis = new Vector*[3];                //!< the references to the obb axis
-//   float**               a = new float*[4];
-//   float**               b = new float*[4];
-//   float                 eigval[3];
-//   int*                  rot = new int;
-
-
-  //coMat[0] = new float[4]; coMat[1] = new float[4]; coMat[2] = new float[4]; coMat[3] = new float[4];
-  //eigvMat[0] = new float[4]; eigvMat[1] = new float[4]; eigvMat[2] = new float[4]; eigvMat[3] = new float[4];
 
   coMat[1][1] = box->covarianceMatrix[0][0]; coMat[1][2] = box->covarianceMatrix[0][1]; coMat[1][3] = box->covarianceMatrix[0][2];
@@ -244,5 +237,4 @@
   JacobI(coMat, 3, eigvlMat, eigvMat, rotCount);
   PRINTF(0)("-- Done Jacobi Decomposition\n");
-
 
 
@@ -267,16 +259,8 @@
 //   printf("eigenvector: %f, %f, %f\n", box->axis[1]->x, box->axis[1]->y, box->axis[1]->z);
 //   printf("eigenvector: %f, %f, %f\n", box->axis[2]->x, box->axis[2]->y, box->axis[2]->z);
-
-
-//   delete [] a[0]; delete [] a[1]; delete [] a[2]; delete [] a[3];
-//   delete [] a;
-//
-//   delete [] b[0]; delete [] b[1]; delete [] b[2]; delete [] b[3];
-//   delete [] b;
-//
-//   delete rot;
-}
-
-void OBBTreeNode::calculateBoxAttributes3(OBB* box, sVec3D* verticesList, int length)
+}
+
+
+void OBBTreeNode::calculateBoxAxis(OBB* box, sVec3D* verticesList, int length)
 {
 
@@ -370,11 +354,15 @@
   the points depending on which side they are located
   */
-  Plane              separationPlane(*box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
   tList<sVec3D>      partition1;                           //!< the vertex partition 1
   tList<sVec3D>      partition2;                           //!< the vertex partition 2
 
+
+  this->separationPlane = new Plane(*box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
+  this->sepPlaneCenter = &box->vertices[vertexIndex];
+  this->longestAxisIndex = axisIndex;
+
   for(int i = 0; i < box->numOfVertices; ++i)
   {
-    if( separationPlane.distancePoint(box->vertices[i]) > 0.0f)
+    if( this->separationPlane->distancePoint(box->vertices[i]) > 0.0f)
       partition1.add(&box->vertices[i]);
     else
@@ -573,14 +561,21 @@
   glEnd();
 
-/*
-  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]);
-  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]);*/
-
-
-  glEnd();
+
+  if( depth != 0)
+  {
+    /* now draw the separation plane */
+    Vector a1 = *this->bvElement->axis[(this->longestAxisIndex + 1)%3];
+    Vector a2 = *this->bvElement->axis[(this->longestAxisIndex + 2)%3];
+    Vector c = *this->bvElement->center;
+    float l1 = this->bvElement->halfLength[(this->longestAxisIndex + 1)%3];
+    float l2 = this->bvElement->halfLength[(this->longestAxisIndex + 2)%3];
+    glBegin(GL_QUADS);
+    glVertex3f(c.x + a1.x * l1 + a2.x * l2, c.y + a1.y * l1+ a2.y * l2, c.z + a1.z * l1 + a2.z * l2);
+    glVertex3f(c.x - a1.x * l1 + a2.x * l2, c.y - a1.y * l1+ a2.y * l2, c.z - a1.z * l1 + a2.z * l2);
+    glVertex3f(c.x - a1.x * l1 - a2.x * l2, c.y - a1.y * l1- a2.y * l2, c.z - a1.z * l1 - a2.z * l2);
+    glVertex3f(c.x + a1.x * l1 - a2.x * l2, c.y + a1.y * l1- a2.y * l2, c.z + a1.z * l1 - a2.z * l2);
+
+    glEnd();
+  }
 
   if( this->nodeLeft != NULL && depth != 0 )
Index: /orxonox/trunk/src/lib/collision_detection/obb_tree_node.h
===================================================================
--- /orxonox/trunk/src/lib/collision_detection/obb_tree_node.h	(revision 4631)
+++ /orxonox/trunk/src/lib/collision_detection/obb_tree_node.h	(revision 4632)
@@ -16,4 +16,5 @@
 class OBB;
 class OBBTree;
+class Plane;
 //struct sVec3D;
 
@@ -41,7 +42,7 @@
 
   private:
-    void calculateBoxAttributes1(OBB* box, sVec3D* verticesList, int length);
-    void calculateBoxAttributes2(OBB* box, sVec3D* verticesList, int length);
-    void calculateBoxAttributes3(OBB* box, sVec3D* verticesList, int length);
+    void calculateBoxCovariance(OBB* box, sVec3D* verticesList, int length);
+    void calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length);
+    void calculateBoxAxis(OBB* box, sVec3D* verticesList, int length);
     void forkBox(OBB* box);
 
@@ -59,15 +60,18 @@
     int                 depth;                      //!< the depth of the node in the tree
     static OBBTree*     obbTree;                    //!< reference to the obb tree
+    Plane*              separationPlane;            //!< the separation plane of the obb
+    sVec3D*             sepPlaneCenter;             //!< only needed to draw plane \todo: separationPlane drawing
+    int                 longestAxisIndex;           //!< only needed to draw plane
 
     /* tmp saving place for obb variables */
-    sVec3D*             tmpVert1;
-    sVec3D*             tmpVert2;
-    int                 tmpLen1;
-    int                 tmpLen2;
+    sVec3D*             tmpVert1;                   //!< pointer to the vert data of obbox1
+    sVec3D*             tmpVert2;                   //!< pointer to the vert data of obbox1
+    int                 tmpLen1;                    //!< len vert data obbox1
+    int                 tmpLen2;                    //!< len vert data obbox2
 
-    static float**       coMat;
-    static float**       eigvMat;
-    static float*        eigvlMat;
-    static int*          rotCount;
+    static float**       coMat;                     //!< temp covariance matrice save place - consumes less mem
+    static float**       eigvMat;                   //!< temp eigenvector matrice save place
+    static float*        eigvlMat;                  //!< temp eigenvalue vector save place
+    static int*          rotCount;                  //!< temp rotations count save place: how many givens-rotations where needed to transform the matrix :)
 };
 
Index: /orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
===================================================================
--- /orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4631)
+++ /orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4632)
@@ -47,5 +47,5 @@
 //   }
 
-  CDEngine::getInstance()->debugSpawnTree(4, model->data->pVertices, model->data->numVertices);
+  CDEngine::getInstance()->debugSpawnTree(2, model->data->pVertices, model->data->numVertices);
 
 
@@ -82,5 +82,5 @@
 void Framework::moduleDraw() const
 {
-  CDEngine::getInstance()->drawBV(3);
+  CDEngine::getInstance()->drawBV(1);
 
   LightManager::getInstance()->draw();
