Index: orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4577)
+++ orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4578)
@@ -136,6 +136,11 @@
     }
 
-  
-  printf("Covariance Matrix:\n");
+    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)
     {
@@ -206,10 +211,25 @@
 
   /* now get the axis length */
-  Line                ax1(*box->center, *box->axis[0]);      //!< the the axis representation
-  Line                ax2(*box->center, *box->axis[1]);      //!< the the axis representation
-  Line                ax3(*box->center, *box->axis[2]);      //!< the the axis representation
-  
-
-  
+  Line                ax[3];                                 //!< the axis
+  float*              halfLength = new float[3];             //!< half length of the axis
+  float               tmpLength;                             //!< tmp save point for the length
+  
+  ax[0].r = *box->center; ax[0].a = *box->axis[0];
+  ax[1].r = *box->center; ax[1].a = *box->axis[1];
+  ax[2].r = *box->center; ax[2].a = *box->axis[2];
+
+  for(int i = 0; i < 3; ++i)
+  {
+    for(int j = 0; j < length; ++j)
+    {
+      tmpLength = ax[i].distancePoint(vertices[j]);
+      if( tmpLength > halfLength[i])
+        halfLength[i] = tmpLength; 
+    }
+  }
+
+  printf("we got length: \n");
+  for(int i = 0; i < 3; ++i)
+    printf("length[%i] = %f\n", i, halfLength[i]);
 }
 
Index: orxonox/trunk/src/lib/math/vector.cc
===================================================================
--- orxonox/trunk/src/lib/math/vector.cc	(revision 4577)
+++ orxonox/trunk/src/lib/math/vector.cc	(revision 4578)
@@ -1,3 +1,3 @@
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -10,8 +10,8 @@
 
    ### File Specific:
-   main-programmer: Christian Meyer 
+   main-programmer: Christian Meyer
    co-programmer: Patrick Boenzli : Vector::scale()
                                     Vector::abs()
-   
+
    Quaternion code borrowed from an Gamasutra article by Nick Bobick and Ken Shoemake
 */
@@ -48,5 +48,5 @@
    \brief Vector is looking in the positive direction on all axes after this
 */
-Vector Vector::abs() 
+Vector Vector::abs()
 {
   Vector v(fabs(x), fabs(y), fabs(z));
@@ -74,10 +74,10 @@
    \param dir: the direction you want to look
    \param up: specify what direction up should be
-   
+
    Mathematically this determines the rotation a (0,0,1)-Vector has to undergo to point
    the same way as dir. If you want to use this with cameras, you'll have to reverse the
    dir Vector (Vector(0,0,0) - your viewing direction) or you'll point the wrong way. You
-   can use this for meshes as well (then you do not have to reverse the vector), but keep 
-   in mind that if you do that, the model's front has to point in +z direction, and left 
+   can use this for meshes as well (then you do not have to reverse the vector), but keep
+   in mind that if you do that, the model's front has to point in +z direction, and left
    and right should be -x or +x respectively or the mesh wont rotate correctly.
 */
@@ -85,9 +85,9 @@
 {
   Vector z = dir;
-  z.normalize(); 
+  z.normalize();
   Vector x = up.cross(z);
-  x.normalize(); 
+  x.normalize();
   Vector y = z.cross(x);
-  
+
   float m[4][4];
   m[0][0] = x.x;
@@ -107,5 +107,5 @@
   m[3][2] = 0;
   m[3][3] = 1;
-  
+
   *this = Quaternion (m);
 }
@@ -120,17 +120,17 @@
 {
   float cr, cp, cy, sr, sp, sy, cpcy, spsy;
-  
+
   // calculate trig identities
   cr = cos(roll/2);
   cp = cos(pitch/2);
   cy = cos(yaw/2);
-  
+
   sr = sin(roll/2);
   sp = sin(pitch/2);
   sy = sin(yaw/2);
-  
+
   cpcy = cp * cy;
   spsy = sp * sy;
-  
+
   w = cr * cpcy + sr * spsy;
   v.x = sr * cpcy - cr * spsy;
@@ -147,8 +147,8 @@
 {
   float A, B, C, D, E, F, G, H;
-  
+
   A = (w   + v.x)*(q.w   + q.v.x);
   B = (v.z - v.y)*(q.v.y - q.v.z);
-  C = (w   - v.x)*(q.v.y + q.v.z); 
+  C = (w   - v.x)*(q.v.y + q.v.z);
   D = (v.y + v.z)*(q.w   - q.v.x);
   E = (v.x + v.z)*(q.v.x + q.v.y);
@@ -156,5 +156,5 @@
   G = (w   + v.y)*(q.w   - q.v.z);
   H = (w   - v.y)*(q.w   + q.v.z);
-  
+
   Quaternion r;
   r.v.x = A - (E + F + G + H)/2;
@@ -234,6 +234,6 @@
    \brief calculate the inverse value of the Quaternion
    \return the inverse Quaternion
-   
-	Note that this is equal to conjugate() if the Quaternion's norm is 1
+
+        Note that this is equal to conjugate() if the Quaternion's norm is 1
 */
 Quaternion Quaternion::inverse() const
@@ -253,23 +253,23 @@
 void Quaternion::matrix (float m[4][4]) const
 {
-  float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; 
-  
+  float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2;
+
   // calculate coefficients
   x2 = v.x + v.x;
-  y2 = v.y + v.y; 
+  y2 = v.y + v.y;
   z2 = v.z + v.z;
   xx = v.x * x2; xy = v.x * y2; xz = v.x * z2;
   yy = v.y * y2; yz = v.y * z2; zz = v.z * z2;
   wx = w * x2; wy = w * y2; wz = w * z2;
-  
+
   m[0][0] = 1.0 - (yy + zz); m[1][0] = xy - wz;
   m[2][0] = xz + wy; m[3][0] = 0.0;
-	
+
   m[0][1] = xy + wz; m[1][1] = 1.0 - (xx + zz);
   m[2][1] = yz - wx; m[3][1] = 0.0;
-  
+
   m[0][2] = xz - wy; m[1][2] = yz + wx;
   m[2][2] = 1.0 - (xx + yy); m[3][2] = 0.0;
-  
+
   m[0][3] = 0; m[1][3] = 0;
   m[2][3] = 0; m[3][3] = 1;
@@ -292,7 +292,7 @@
   cosom = from.v.x * to.v.x + from.v.y * to.v.y + from.v.z * to.v.z + from.w * to.w;
 
-  if( cosom < 0.0 ) 
-    { 
-      cosom = -cosom; 
+  if( cosom < 0.0 )
+    {
+      cosom = -cosom;
       tol[0] = -to.v.x;
       tol[1] = -to.v.y;
@@ -307,5 +307,5 @@
       tol[3] = to.w;
     }
-  
+
   //if( (1.0 - cosom) > DELTA )
   //{
@@ -332,7 +332,7 @@
   */
   return Quaternion(Vector(scale0 * from.v.x + scale1 * tol[0],
-			   scale0 * from.v.y + scale1 * tol[1],
-			   scale0 * from.v.z + scale1 * tol[2]),
-		    scale0 * from.w + scale1 * tol[3]);
+                           scale0 * from.v.y + scale1 * tol[1],
+                           scale0 * from.v.z + scale1 * tol[2]),
+                    scale0 * from.w + scale1 * tol[3]);
 }
 
@@ -344,5 +344,5 @@
 Quaternion::Quaternion (float m[4][4])
 {
-	
+
   float  tr, s, q[4];
   int    i, j, k;
@@ -352,6 +352,6 @@
   tr = m[0][0] + m[1][1] + m[2][2];
 
-  	// check the diagonal
-  if (tr > 0.0) 
+        // check the diagonal
+  if (tr > 0.0)
   {
     s = sqrt (tr + 1.0);
@@ -361,10 +361,10 @@
     v.y = (m[2][0] - m[0][2]) * s;
     v.z = (m[0][1] - m[1][0]) * s;
-	} 
-	else 
-	{
- 		// diagonal is negative
-  	i = 0;
-  	if (m[1][1] > m[0][0]) i = 1;
+        }
+        else
+        {
+                // diagonal is negative
+        i = 0;
+        if (m[1][1] > m[0][0]) i = 1;
     if (m[2][2] > m[i][i]) i = 2;
     j = nxt[i];
@@ -372,17 +372,17 @@
 
     s = sqrt ((m[i][i] - (m[j][j] + m[k][k])) + 1.0);
-      
+
     q[i] = s * 0.5;
-            
+
     if (s != 0.0) s = 0.5 / s;
-	
-	  q[3] = (m[j][k] - m[k][j]) * s;
+
+          q[3] = (m[j][k] - m[k][j]) * s;
     q[j] = (m[i][j] + m[j][i]) * s;
     q[k] = (m[i][k] + m[k][i]) * s;
 
-  	v.x = q[0];
-  	v.y = q[1];
-  	v.z = q[2];
-  	w = q[3];
+        v.x = q[0];
+        v.y = q[1];
+        v.z = q[2];
+        w = q[3];
   }
 }
@@ -486,25 +486,25 @@
    \brief fills the specified buffer with a 4x4 glmatrix
    \param buffer: Pointer to an array of 16 floats
-   
+
    Use this to get the rotation in a gl-compatible format
 */
 void Rotation::glmatrix (float* buffer)
 {
-	buffer[0] = m[0];
-	buffer[1] = m[3];
-	buffer[2] = m[6];
-	buffer[3] = m[0];
-	buffer[4] = m[1];
-	buffer[5] = m[4];
-	buffer[6] = m[7];
-	buffer[7] = m[0];
-	buffer[8] = m[2];
-	buffer[9] = m[5];
-	buffer[10] = m[8];
-	buffer[11] = m[0];
-	buffer[12] = m[0];
-	buffer[13] = m[0];
-	buffer[14] = m[0];
-	buffer[15] = m[1];
+        buffer[0] = m[0];
+        buffer[1] = m[3];
+        buffer[2] = m[6];
+        buffer[3] = m[0];
+        buffer[4] = m[1];
+        buffer[5] = m[4];
+        buffer[6] = m[7];
+        buffer[7] = m[0];
+        buffer[8] = m[2];
+        buffer[9] = m[5];
+        buffer[10] = m[8];
+        buffer[11] = m[0];
+        buffer[12] = m[0];
+        buffer[13] = m[0];
+        buffer[14] = m[0];
+        buffer[15] = m[1];
 }
 
@@ -513,24 +513,24 @@
    \param r: another Rotation
    \return the matrix product of the Rotations
-   
+
    Use this to rotate one rotation by another
 */
 Rotation Rotation::operator* (const Rotation& r)
 {
-	Rotation p;
-	
-	p.m[0] = m[0]*r.m[0] + m[1]*r.m[3] + m[2]*r.m[6];
-	p.m[1] = m[0]*r.m[1] + m[1]*r.m[4] + m[2]*r.m[7];
-	p.m[2] = m[0]*r.m[2] + m[1]*r.m[5] + m[2]*r.m[8];
-	
-	p.m[3] = m[3]*r.m[0] + m[4]*r.m[3] + m[5]*r.m[6];
-	p.m[4] = m[3]*r.m[1] + m[4]*r.m[4] + m[5]*r.m[7];
-	p.m[5] = m[3]*r.m[2] + m[4]*r.m[5] + m[5]*r.m[8];
-
-	p.m[6] = m[6]*r.m[0] + m[7]*r.m[3] + m[8]*r.m[6];
-	p.m[7] = m[6]*r.m[1] + m[7]*r.m[4] + m[8]*r.m[7];
-	p.m[8] = m[6]*r.m[2] + m[7]*r.m[5] + m[8]*r.m[8];
-	
-	return p;
+        Rotation p;
+
+        p.m[0] = m[0]*r.m[0] + m[1]*r.m[3] + m[2]*r.m[6];
+        p.m[1] = m[0]*r.m[1] + m[1]*r.m[4] + m[2]*r.m[7];
+        p.m[2] = m[0]*r.m[2] + m[1]*r.m[5] + m[2]*r.m[8];
+
+        p.m[3] = m[3]*r.m[0] + m[4]*r.m[3] + m[5]*r.m[6];
+        p.m[4] = m[3]*r.m[1] + m[4]*r.m[4] + m[5]*r.m[7];
+        p.m[5] = m[3]*r.m[2] + m[4]*r.m[5] + m[5]*r.m[8];
+
+        p.m[6] = m[6]*r.m[0] + m[7]*r.m[3] + m[8]*r.m[6];
+        p.m[7] = m[6]*r.m[1] + m[7]*r.m[4] + m[8]*r.m[7];
+        p.m[8] = m[6]*r.m[2] + m[7]*r.m[5] + m[8]*r.m[8];
+
+        return p;
 }
 
@@ -545,5 +545,5 @@
 {
   Vector t;
-  
+
   t.x = v.x * r.m[0] + v.y * r.m[1] + v.z * r.m[2];
   t.y = v.x * r.m[3] + v.y * r.m[4] + v.z * r.m[5];
@@ -581,4 +581,17 @@
 
 /**
+   \brief calculate the distance between a line and a point
+   \param v: the point
+   \return the distance between the Line and the point
+ */
+float Line::distancePoint (const sVec3D& v) const
+{
+  Vector s(v[0], v[1], v[2]);
+  Vector d = s - r;
+  Vector u = a * d.dot( a);
+  return (d - u).len();
+}
+
+/**
    \brief calculate the two points of minimal distance of two lines
    \param l: the other line
@@ -597,5 +610,5 @@
 /**
   \brief calculate the length of a line
-  \return the lenght of the line 
+  \return the lenght of the line
 */
 float Line::len() const
Index: orxonox/trunk/src/lib/math/vector.h
===================================================================
--- orxonox/trunk/src/lib/math/vector.h	(revision 4577)
+++ orxonox/trunk/src/lib/math/vector.h	(revision 4578)
@@ -1,8 +1,8 @@
-/*! 
+/*!
     \file vector.h
     \brief A basic 3D math framework
-    
+
     Contains classes to handle vectors, lines, rotations and planes
-*/ 
+*/
 
 #ifndef _VECTOR_H
@@ -17,5 +17,5 @@
 //! 3D Vector
 /**
-	Class to handle 3D Vectors
+        Class to handle 3D Vectors
 */
 class Vector {
@@ -63,13 +63,13 @@
   /** \brief normalizes the vector */
   inline void normalize() {
-                      float l = len(); 
-		      if( unlikely(l == 0.0)) 
-			{ 
-			  // Prevent divide by zero
-			  return;
-			}
-		      x = x / l;
-		      y = y / l;
-		      z = z / l; 
+                      float l = len();
+                      if( unlikely(l == 0.0))
+                        {
+                          // Prevent divide by zero
+                          return;
+                        }
+                      x = x / l;
+                      y = y / l;
+                      z = z / l;
                     }
   Vector getNormalized() const;
@@ -123,5 +123,5 @@
   inline const Quaternion& operator*= (const float& f) {*this = *this * f; return *this;}
   Quaternion operator* (const Quaternion& q) const;
-  /** \param q: the Quaternion to multiply by \returns the quaternion multiplied by q (this *= q) */  
+  /** \param q: the Quaternion to multiply by \returns the quaternion multiplied by q (this *= q) */
   inline const Quaternion operator*= (const Quaternion& q) {*this = *this * q; return *this; };
   /** \param q the Quaternion to add to this \returns the quaternion added with q (this + q) */
@@ -141,5 +141,5 @@
   float norm () const;
   void matrix (float m[4][4]) const;
-  
+
   void debug();
 
@@ -161,7 +161,7 @@
 class Rotation {
   public:
-  
+
   float m[9]; //!< 3x3 Rotation Matrix
-  
+
   Rotation ( const Vector& v);
   Rotation ( const Vector& axis, float angle);
@@ -169,7 +169,7 @@
   Rotation ();
   ~Rotation () {}
-  
+
   Rotation operator* (const Rotation& r);
-  
+
   void glmatrix (float* buffer);
 };
@@ -187,17 +187,18 @@
 {
   public:
-  
+
   Vector r;   //!< Offset
   Vector a;   //!< Direction
-  
+
   Line ( Vector r, Vector a) : r(r), a(a) {}  //!< assignment constructor
   Line () : r(Vector(0,0,0)), a(Vector (1,1,1)) {}
   ~Line () {}
-  
+
   float distance (const Line& l) const;
   float distancePoint (const Vector& v) const;
+  float distancePoint (const sVec3D& v) const;
   Vector* footpoints (const Line& l) const;
   float len () const;
-  
+
   void rotate(const Rotation& rot);
 };
@@ -206,5 +207,5 @@
 /**
   Class to handle planes in 3-dimensional space
-  
+
   Critical for polygon-based collision detection
 */
@@ -212,8 +213,8 @@
 {
   public:
-  
+
   Vector n;   //!< Normal vector
   float k;    //!< Offset constant
-  
+
   Plane (Vector a, Vector b, Vector c);
   Plane (Vector norm, Vector p);
@@ -221,5 +222,5 @@
   Plane () : n(Vector(1,1,1)), k(0) {}
   ~Plane () {}
-  
+
   Vector intersectLine (const Line& l) const;
   float distancePoint (const Vector& p) const;
