Index: trunk/src/lib/collision_detection/lin_alg.h
===================================================================
--- trunk/src/lib/collision_detection/lin_alg.h	(revision 5427)
+++ trunk/src/lib/collision_detection/lin_alg.h	(revision 5428)
@@ -24,15 +24,13 @@
 void JacobI(float **A,int N,float *D, float **V, int *NROT) {
 float  *B, *Z;
-double  c,g,h,s,sm,t,tau,theta,tresh;
-int     i,j,ip,iq;
-
-// void *vmblock1 = NULL;
+double  c=0.0f, g=0.0f, h=0.0f, s=0.0f, sm=0.0f, t=0.0f, tau=0.0f, theta=0.0f, tresh=0.0f;
+int     i=0,j=0,ip=0,iq=0;
 
   //allocate vectors B, Z
-  //vmblock1 = vminit();
+
   B = (float *) calloc(100, 32);
   Z = (float *) calloc(100, 32);
 
-  for (ip=1; ip<=N; ip++) {  //initialize V to identity matrix
+  for(ip=1; ip<=N; ip++) {  //initialize V to identity matrix
     for (iq=1; iq<=N; iq++)  V[ip][iq]=0;
     V[ip][ip]=1;
@@ -118,4 +116,6 @@
   } //end of main i loop
 //  printf("\n 50 iterations !\n");
+  free(B);
+  free(Z);
   return;  //too many iterations
 }
Index: trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 5427)
+++ trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 5428)
@@ -160,5 +160,5 @@
 {
   float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
-  float     face;                                    //!< surface area of the entire convex hull
+  float     face = 0.0f;                             //!< surface area of the entire convex hull
   Vector    centroid[length];                        //!< centroid of the i'th convex hull
   Vector    center;                                  //!< the center of the entire hull
@@ -175,5 +175,5 @@
   {
     /* fist compute all the convex hull face/facelets and centroids */
-    for(int i = 0; i+3 < length ; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
+    for( int i = 0; i+3 < length ; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
     {
       p = verticesList[i];
@@ -199,9 +199,9 @@
 
     /* 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 j = 0; j < 3; ++j)
+    {
+      for( int k = 0; k < 3; ++k)
       {
-        for(int i = 0; i < length; i+=3)
+        for( int i = 0; i + 3 < length; i+=3)
         {
           p = verticesList[i];
@@ -218,5 +218,5 @@
   else if( mode == 1)
   {
-    for( int i = 0; i < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
+    for( int i = 0; i + 3 < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
     {
       p = verticesList[i];
@@ -233,5 +233,5 @@
       for( int k = 0; k < 3; ++k)
       {
-        for( int i = 0; i < length; i+=3)
+        for( int i = 0; i + 3 < length; i+=3)
         {
           p = verticesList[i];
@@ -249,5 +249,5 @@
   {
     /* 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*/
+    for(int i = 0; i + 3 < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
     {
       p = verticesList[i];
@@ -275,5 +275,5 @@
       for( int k = 0; k < 3; ++k)
       {
-        for( int i = 0; i < length; i+=3)
+        for( int i = 0; i + 3 < length; i+=3)
         {
           p = verticesList[i];
@@ -300,5 +300,5 @@
       for( int k = 0; k < 3; ++k)
       {
-        for( int i = 0; i < length; i+=3)
+        for( int i = 0; i + 3 < length; i+=3)
         {
           p = verticesList[i];
Index: trunk/src/world_entities/environment.cc
===================================================================
--- trunk/src/world_entities/environment.cc	(revision 5427)
+++ trunk/src/world_entities/environment.cc	(revision 5428)
@@ -38,6 +38,6 @@
   this->loadModel("models/ships/bolido.obj");
 
-/*  if(this->obbTree == NULL)
-    this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());*/
+  if(this->obbTree == NULL)
+    this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
 }
 
Index: trunk/src/world_entities/test_entity.cc
===================================================================
--- trunk/src/world_entities/test_entity.cc	(revision 5427)
+++ trunk/src/world_entities/test_entity.cc	(revision 5428)
@@ -37,5 +37,5 @@
 //   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
 // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
-//  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
+  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
 
   this->md2Model->setAnim(RUN);
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 5427)
+++ trunk/src/world_entities/world_entity.cc	(revision 5428)
@@ -98,19 +98,19 @@
 bool WorldEntity::buildObbTree(unsigned int depth)
 {
-//   if (this->obbTree)
-//     delete this->obbTree;
-//
-//   if (this->model)
-//   {
-//     PRINTF(4)("creating obb tree\n");
-//     this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
-//     return true;
-//   }
-//   else
-//   {
-//     PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
-//     this->obbTree = NULL;
-//     return false;
-//  }
+  if (this->obbTree)
+    delete this->obbTree;
+
+  if (this->model)
+  {
+    PRINTF(4)("creating obb tree\n");
+    this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
+    return true;
+  }
+  else
+  {
+    PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
+    this->obbTree = NULL;
+    return false;
+  }
 }
 
