Index: /trunk/src/lib/math/matrix.cc
===================================================================
--- /trunk/src/lib/math/matrix.cc	(revision 5695)
+++ /trunk/src/lib/math/matrix.cc	(revision 5696)
@@ -14,9 +14,137 @@
 */
 #include "matrix.h"
-
+#include <math.h>
+
+#ifdef DEBUG
+#include "debug.h"
+#else
 #include <stdio.h>
-#include <math.h>
-
-
+#define PRINT(x) printf
+#endif
+
+/**
+ * constructs a Matrix from all Parameters in a Row
+ * @param m11 [0][0]
+ * @param m12 [0][1]
+ * @param m13 [0][2]
+ * @param m21 [1][0]
+ * @param m22 [1][1]
+ * @param m23 [1][2]
+ * @param m31 [2][0]
+ * @param m32 [2][1]
+ * @param m33 [2][2]
+ */
+Matrix::Matrix ( float m11, float m12, float m13,
+             float m21, float m22, float m23,
+             float m31, float m32, float m33 )
+{
+  this->m11 = m11; this->m12 = m12; this->m13 = m13;
+  this->m21 = m21; this->m22 = m22; this->m23 = m23;
+  this->m31 = m31; this->m32 = m32; this->m33 = m33;
+};
+
+/**
+ * creates a Matrix out of an Array of floats with size [3][3]
+ * @param m the Matrix stored in an Array
+ */
+Matrix::Matrix(const float m[3][3])
+{
+  this->m11 = m[0][0]; this->m12 = m[0][1]; this->m13 = m[0][2];
+  this->m21 = m[1][0]; this->m22 = m[1][1]; this->m23 = m[1][2];
+  this->m31 = m[2][0]; this->m32 = m[2][1]; this->m33 = m[2][2];
+};
+
+
+/**
+ * adds a Matrix to this one returning the result
+ * @param m the Matrix to add to this one
+ * @returns a copy of this Matrix added m
+ */
+Matrix Matrix::operator+ (const Matrix& m) const
+{
+  return Matrix (this->m11 + m.m11, this->m12 + m.m12, this->m13 + m.m13,
+                 this->m21 + m.m21, this->m22 + m.m22, this->m23 + m.m23,
+                 this->m31 + m.m31, this->m32 + m.m32, this->m33 + m.m33);
+}
+
+/**
+ * sustracts a Matrix from this one returning the result
+ * @param m the Matrix to substract from this one
+ * @returns a copy of this Matrix substracted m
+ */
+Matrix Matrix::operator- (const Matrix& m) const
+{
+  return Matrix (this->m11 - m.m11, this->m12 - m.m12, this->m13 - m.m13,
+                 this->m21 - m.m21, this->m22 - m.m22, this->m23 - m.m23,
+                 this->m31 - m.m31, this->m32 - m.m32, this->m33 - m.m33);
+}
+
+/**
+ * multiplies each value of a copu of this Matrix by k
+ * @param k the multiplication factor
+ * @returns a copy of this Matrix multiplied by k
+ */
+Matrix Matrix::operator* (float k) const
+{
+  return Matrix(this->m11 * k, this->m12 * k, this->m13 * k,
+                this->m21 * k, this->m22 * k, this->m23 * k,
+                this->m31 * k, this->m32 * k, this->m33 * k);
+}
+
+/**
+ * multiplies the Matrix by a Vector returning a Vector of the result
+ * @param v the Vector the matrix will be multiplied with
+ * @returns the result of the Multiplication
+ */
+Vector Matrix::operator* (const Vector& v) const
+{
+  return Vector (this->m11*v.x + this->m12*v.y + this->m13*v.z,
+                 this->m21*v.x + this->m22*v.y + this->m23*v.z,
+                 this->m31*v.x + this->m32*v.y + this->m33*v.z );
+}
+
+/**
+ * @returns a Transposed copy of this Matrix
+ */
+Matrix Matrix::getTransposed() const
+{
+  return Matrix( this->m11, this->m21, this->m31,
+                 this->m12, this->m22, this->m32,
+                 this->m13, this->m23, this->m33);
+}
+
+/**
+ * converts the Matrix into 3 Vector, and returns them in m1, m2 and m3
+ * @param m1 the first Column of the Matrix as a Vector
+ * @param m2 the second Column of the Matrix as a Vector
+ * @param m3 the third Column of the Matrix as a Vector
+ */
+void Matrix::toVectors(Vector& m1, Vector& m2, Vector& m3) const
+{
+  m1 = Vector(this->m11, this->m21, this->m31);
+  m2 = Vector(this->m12, this->m22, this->m32);
+  m3 = Vector(this->m13, this->m23, this->m33);
+}
+
+/**
+ * @returns the Determinant of this Matrix
+ */
+float Matrix::getDeterminant() const
+{
+  return this->m11*(this->m22*this->m33 - this->m23*this->m32) -
+      this->m12*(this->m21*this->m33 - this->m23*this->m31) +
+      this->m13*(this->m21*this->m32 - this->m22*this->m31);
+}
+
+/**
+ * calculates an returns the EingenValues of this Matrix.
+ * @param eigneValues the Values calculated in a Vector
+ * @returns the Count of found eigenValues
+ *
+ * This Function calculates the EigenValues of a 3x3-Matrix explicitly.
+ * the Returned value eigenValues has the Values stored in Vector form
+ * The Vector will be filled upside down, meaning if the count of found
+ * eingenValues is 1 the only value will be located in eigneValues.x
+ */
 int Matrix::getEigenValues(Vector& eigenValues) const
 {
@@ -83,4 +211,10 @@
 }
 
+/**
+ * calculates and returns the EigenVectors of this function as Vectors.
+ * @param eigVc1 the first eigenVector will be stored here.
+ * @param eigVc2 the second eigenVector will be stored here.
+ * @param eigVc3 the third eigenVector will be stored here.
+ */
 void Matrix::getEigenVectors(Vector& eigVc1, Vector& eigVc2, Vector& eigVc3) const
 {
@@ -122,4 +256,7 @@
 }
 
+/**
+ * prints out some nice debug information
+ */
 void Matrix::debug() const
 {
Index: /trunk/src/lib/math/matrix.h
===================================================================
--- /trunk/src/lib/math/matrix.h	(revision 5695)
+++ /trunk/src/lib/math/matrix.h	(revision 5696)
@@ -7,8 +7,7 @@
 #include "vector.h"
 
-
+//! Matrix is a 3x3 Matrix class with most important functions
 class Matrix
 {
-
   public:
     Matrix() : m11(0), m12(0), m13(0), m21(0), m22(0), m23(0), m31(0), m32(0), m33(0) { };
@@ -16,52 +15,16 @@
     Matrix ( float m11, float m12, float m13,
              float m21, float m22, float m23,
-             float m31, float m32, float m33 )
-    {
-      this->m11 = m11; this->m12 = m12; this->m13 = m13;
-      this->m21 = m21; this->m22 = m22; this->m23 = m23;
-      this->m31 = m31; this->m32 = m32; this->m33 = m33;
-    };
-    Matrix(const float m[3][3]) {
-      this->m11 = m[0][0]; this->m12 = m[0][1]; this->m13 = m[0][2];
-      this->m21 = m[1][0]; this->m22 = m[1][1]; this->m23 = m[1][2];
-      this->m31 = m[2][0]; this->m32 = m[2][1]; this->m33 = m[2][2];
-    };
+             float m31, float m32, float m33 );
+    Matrix(const float m[3][3]);
 
-    Matrix operator+ (const Matrix& m) const {
-      return Matrix (this->m11 + m.m11, this->m12 + m.m12, this->m13 + m.m13,
-                     this->m21 + m.m21, this->m22 + m.m22, this->m23 + m.m23,
-                     this->m31 + m.m31, this->m32 + m.m32, this->m33 + m.m33);
-    }
+    Matrix operator+ (const Matrix& m) const;
+    Matrix operator- (const Matrix& m) const;
+    Matrix operator* (float k) const;
+    Vector operator* (const Vector& v) const;
 
-    Matrix operator- (const Matrix& m) const {
-      return Matrix (this->m11 - m.m11, this->m12 - m.m12, this->m13 - m.m13,
-                     this->m21 - m.m21, this->m22 - m.m22, this->m23 - m.m23,
-                     this->m31 - m.m31, this->m32 - m.m32, this->m33 - m.m33);
-    }
+    Matrix getTransposed() const;
+    void toVectors(Vector& m1, Vector& m2, Vector& m3) const;
 
-    Matrix operator* (float k) const {
-      return Matrix(this->m11 - k, this->m12 - k, this->m13 - k,
-                    this->m21 - k, this->m22 - k, this->m23 - k,
-                    this->m31 - k, this->m32 - k, this->m33 - k);
-    }
-
-    Vector operator* (const Vector& v) const {
-      return Vector (this->m11*v.x + this->m12*v.y + this->m13*v.z,
-                     this->m21*v.x + this->m22*v.y + this->m23*v.z,
-                     this->m31*v.x + this->m32*v.y + this->m33*v.z );
-    }
-
-
-    Matrix getTransposed() const {
-      return Matrix( this->m11, this->m21, this->m31,
-                     this->m12, this->m22, this->m32,
-                     this->m13, this->m23, this->m33);
-    }
-
-    void toVectors(Vector& m1, Vector& m2, Vector& m3) const {
-      m1 = Vector(this->m11, this->m12, this->m13);
-      m2 = Vector(this->m21, this->m22, this->m23);
-      m3 = Vector(this->m31, this->m32, this->m33);
-    }
+    float getDeterminant() const;
 
     int getEigenValues(Vector& eigenVectors) const;
@@ -73,9 +36,7 @@
     void debug() const;
 
-
   public:
     float m11;    float m12;     float m13;
     float m21;    float m22;     float m23;
     float m31;    float m32;     float m33;
-
 };
