Index: /orxonox/branches/parenting/src/curve.cc
===================================================================
--- /orxonox/branches/parenting/src/curve.cc	(revision 3326)
+++ /orxonox/branches/parenting/src/curve.cc	(revision 3327)
@@ -23,7 +23,9 @@
 
 #include "curve.h"
+#include "matrix.h"
 
 #include <math.h>
 #include <stdio.h>
+
 
 /**
@@ -45,4 +47,8 @@
 
 
+///////////////////////////////////
+/// Bezier Curve //////////////////
+///////////////////////////////////
+
 /**
    \brief Creates a new BezierCurve
@@ -70,5 +76,5 @@
    It does this by freeing all the space taken over from the nodes
 */
-BezierCurve::~BezierCurve (void)
+BezierCurve::~BezierCurve(void)
 {
   PathNode* tmpNode;
@@ -197,2 +203,179 @@
   return curvePoint;
 }
+
+
+
+///////////////////////////////////
+//// Uniform Point curve  /////////
+///////////////////////////////////
+/**
+   \brief Creates a new UPointCurve
+*/
+UPointCurve::UPointCurve (void)
+{
+  this->derivation = 0;
+  dirCurve = new UPointCurve(1);
+  this->init();
+}
+
+/**
+   \brief Creates a new UPointCurve-Derivation-Curve of deriavation'th degree
+*/
+UPointCurve::UPointCurve (int derivation)
+{
+  this->derivation = derivation;
+  dirCurve=NULL;
+  this->init();
+}
+
+/**
+   \brief Deletes a UPointCurve.
+
+   It does this by freeing all the space taken over from the nodes
+*/
+UPointCurve::~UPointCurve(void)
+{
+  PathNode* tmpNode;
+  currentNode = firstNode;
+  while (tmpNode != 0)
+    {
+      tmpNode = currentNode;
+      currentNode = currentNode->next;
+      delete tmpNode;
+    }
+  if (dirCurve)
+    delete dirCurve;
+}
+
+/**
+   \brief Initializes a UPointCurve
+*/
+void UPointCurve::init(void)
+{
+  nodeCount = 0;
+  firstNode = new PathNode;
+  currentNode = firstNode;
+
+  firstNode->position = Vector (.0, .0, .0);
+  firstNode->number = 0;
+  firstNode->next = 0; // not sure if this really points to NULL!!
+
+  return;
+}
+
+/**
+   \brief Rebuilds a UPointCurve
+   
+   \todo very bad algorithm
+*/
+void UPointCurve::rebuild(void)
+{
+  // rebuilding the Curve itself
+  PathNode* tmpNode = this->firstNode;
+  int i=0;
+  Matrix xTmpMat = Matrix(this->nodeCount, this->nodeCount);
+  Matrix yTmpMat = Matrix(this->nodeCount, this->nodeCount);
+  Matrix zTmpMat = Matrix(this->nodeCount, this->nodeCount);
+  Matrix xValMat = Matrix(this->nodeCount, 3);
+  Matrix yValMat = Matrix(this->nodeCount, 3);
+  Matrix zValMat = Matrix(this->nodeCount, 3);
+  while(tmpNode)
+    {
+      Vector fac = Vector(1,1,1);
+      for (int j = 0; j < this->nodeCount; j++)
+	{
+	  xTmpMat(i,j) = fac.x; fac.x *= (float)i/(float)this->nodeCount;//tmpNode->position.x;
+	  yTmpMat(i,j) = fac.y; fac.y *= (float)i/(float)this->nodeCount;//tmpNode->position.y;
+	  zTmpMat(i,j) = fac.z; fac.z *= (float)i/(float)this->nodeCount;//tmpNode->position.z;
+	}
+      xValMat(i,0) = tmpNode->position.x;
+      yValMat(i,0) = tmpNode->position.y;
+      zValMat(i,0) = tmpNode->position.z;
+      ++i;
+      tmpNode = tmpNode->next;
+    }
+  tmpNode = this->firstNode;
+  xValMat = xTmpMat.Inv() *= xValMat;
+  yValMat = yTmpMat.Inv() *= yValMat;
+  zValMat = zTmpMat.Inv() *= zValMat;
+  i = 0;
+  while(tmpNode)
+    {
+      tmpNode->vFactor.x = xValMat(i,0);
+      tmpNode->vFactor.y = yValMat(i,0);
+      tmpNode->vFactor.z = zValMat(i,0);
+
+      i++;
+      tmpNode = tmpNode->next;
+    }
+
+  // rebuilding the Derivation curve
+  if(this->derivation == 0)
+    {
+      tmpNode = firstNode;
+      delete dirCurve;
+      dirCurve = new UPointCurve(1);
+      while(tmpNode->next)
+	{
+	  Vector tmpVector = (tmpNode->next->position)- (tmpNode->position);
+	  tmpVector.x*=(float)nodeCount;
+	  tmpVector.y*=(float)nodeCount;
+	  tmpVector.z*=(float)nodeCount;
+	  tmpVector.normalize();
+	  this->dirCurve->addNode(tmpVector);
+	  tmpNode = tmpNode->next;
+	}
+    }
+}
+
+/**
+   \brief calculates the Position on the curve
+   \param t The position on the Curve (0<=t<=1)
+   \return the Position on the Path
+*/
+Vector UPointCurve::calcPos(float t) 
+{
+  PathNode* tmpNode = firstNode;
+  Vector ret = Vector(0.0,0.0,0.0);
+  float factor = 1.0;
+  while(tmpNode)
+    {
+      ret.x += tmpNode->vFactor.x * factor;
+      ret.y += tmpNode->vFactor.y * factor;
+      ret.z += tmpNode->vFactor.z * factor;
+      factor *= t;
+
+      tmpNode = tmpNode->next;
+    }
+  return ret;
+}
+
+/**
+   \brief Calulates the direction of the Curve at time t.
+   \param The time at which to evaluate the curve.
+   \returns The vvaluated Vector.
+*/
+Vector UPointCurve::calcDir (float t)
+{
+  return dirCurve->calcPos(t);
+}
+
+/**
+   \brief Calculates the Quaternion needed for our rotations
+   \param t The time at which to evaluate the cuve.
+   \returns The evaluated Quaternion.
+*/
+Quaternion UPointCurve::calcQuat (float t)
+{
+  return Quaternion (calcDir(t), Vector(0,0,1));
+}
+
+
+/**
+  \brief returns the Position of the point calculated on the Curve
+  \return a Vector to the calculated position
+*/
+Vector UPointCurve::getPos(void) const
+{
+  return curvePoint;
+}
Index: /orxonox/branches/parenting/src/curve.h
===================================================================
--- /orxonox/branches/parenting/src/curve.h	(revision 3326)
+++ /orxonox/branches/parenting/src/curve.h	(revision 3327)
@@ -13,5 +13,5 @@
 
 
-//! An abstract class to handle curves.
+//! An abstract class to handle curves. Needed for the Tracking system in orxonox.
 class Curve
 {
@@ -28,4 +28,5 @@
     int number;          //!< The N-th node of this curve.
     float factor;        //!< Curve specific multiplier factor.
+    Vector vFactor;      //!< A Vector-factor for multipliing.
     Vector position;     //!< Vector Pointung to this curve-point.
     PathNode* next;      //!< Pointer to the next Node.
@@ -46,9 +47,8 @@
 };
 
-//! Bezier Curve
+//!    Class to handle bezier curves in 3-dimesnsional space
 /**
-   Class to handle bezier curves in 3-dimesnsional space
-   
-   needed for  the Tracking system in OrxOnoX.
+   This Curve is good, for Fast Interaction. If you want to change it during the game, go on.
+   !!be aware!! BezierCurves only flow through their first and last Node. Their Tangents at those Points a directed to the second and second-last Point.
 */
 class BezierCurve : public Curve
@@ -81,4 +81,27 @@
 };
 
+//! Uniform Point Curve-class
+/**
+   A UPoint Curve is a A Curve, that flows through all the nodes given it.
+   The Algorithm to buid the curve is rather slow, but Painting and tracing along the curve has high speed, so do not change this curve during the Game.
+
+   This Curve is very erattic, so i do not recommend to use it.
+*/
+class UPointCurve : public Curve
+{
+ private:
+  void rebuild(void);
+ public:
+  UPointCurve(void);
+  UPointCurve(int derivation);
+  ~UPointCurve(void);
+  void init(void);
+
+  Vector calcPos(float t);
+  Vector calcDir(float t);
+  Quaternion calcQuat(float t);
+  
+  Vector getPos(void) const;
+};
 
 #endif /* _CURVE_H */
Index: /orxonox/branches/parenting/src/matrix.cc
===================================================================
--- /orxonox/branches/parenting/src/matrix.cc	(revision 3326)
+++ /orxonox/branches/parenting/src/matrix.cc	(revision 3327)
@@ -21,5 +21,5 @@
 #include "matrix.h"
 
-inline Matrix::Matrix (size_t row, size_t col)
+Matrix::Matrix (size_t row, size_t col)
 {
   _m = new base_mat( row, col, 0);
@@ -27,5 +27,5 @@
 
 // copy constructor
-inline Matrix::Matrix (const Matrix& m)
+Matrix::Matrix (const Matrix& m)
 {
     _m = m._m;
@@ -34,5 +34,5 @@
 
 // Internal copy constructor
-inline void Matrix::clone ()
+void Matrix::clone ()
 {
     _m->Refcnt--;
@@ -41,5 +41,5 @@
 
 // destructor
-inline Matrix::~Matrix ()
+Matrix::~Matrix ()
 {
    if (--_m->Refcnt == 0) delete _m;
@@ -47,5 +47,5 @@
 
 // assignment operator
-inline Matrix& Matrix::operator = (const Matrix& m) 
+Matrix& Matrix::operator = (const Matrix& m) 
 {
     m._m->Refcnt++;
@@ -56,5 +56,5 @@
 
 //  reallocation method
-inline void Matrix::realloc (size_t row, size_t col)
+void Matrix::realloc (size_t row, size_t col)
 {
    if (row == _m->RowSiz && col == _m->ColSiz)
@@ -80,5 +80,5 @@
 
 // public method for resizing Matrix
-inline void Matrix::SetSize (size_t row, size_t col) 
+void Matrix::SetSize (size_t row, size_t col) 
 {
    size_t i,j;
@@ -101,5 +101,5 @@
 
 // subscript operator to get/set individual elements
-inline float& Matrix::operator () (size_t row, size_t col) 
+float& Matrix::operator () (size_t row, size_t col) 
 {
    if (row >= _m->Row || col >= _m->Col)
@@ -110,5 +110,5 @@
 
 // subscript operator to get/set individual elements
-inline float Matrix::operator () (size_t row, size_t col) const 
+float Matrix::operator () (size_t row, size_t col) const 
 {
    if (row >= _m->Row || col >= _m->Col)
@@ -118,5 +118,5 @@
 
 // input stream function
-inline istream& operator >> (istream& istrm, Matrix& m)
+istream& operator >> (istream& istrm, Matrix& m)
 {
    for (size_t i=0; i < m.RowNo(); i++)
@@ -131,5 +131,5 @@
 
 // output stream function
-inline ostream& operator << (ostream& ostrm, const Matrix& m)
+ostream& operator << (ostream& ostrm, const Matrix& m)
 {
    for (size_t i=0; i < m.RowNo(); i++)
@@ -147,5 +147,5 @@
 
 // logical equal-to operator
-inline bool operator == (const Matrix& m1, const Matrix& m2) 
+bool operator == (const Matrix& m1, const Matrix& m2) 
 {
    if (m1.RowNo() != m2.RowNo() || m1.ColNo() != m2.ColNo())
@@ -161,5 +161,5 @@
 
 // logical no-equal-to operator
-inline bool operator != (const Matrix& m1, const Matrix& m2) 
+bool operator != (const Matrix& m1, const Matrix& m2) 
 {
     return (m1 == m2) ? false : true;
@@ -167,5 +167,5 @@
 
 // combined addition and assignment operator
-inline Matrix& Matrix::operator += (const Matrix& m) 
+Matrix& Matrix::operator += (const Matrix& m) 
 {
    if (_m->Row != m._m->Row || _m->Col != m._m->Col)
@@ -179,5 +179,5 @@
 
 // combined subtraction and assignment operator
-inline Matrix& Matrix::operator -= (const Matrix& m) 
+Matrix& Matrix::operator -= (const Matrix& m) 
 {
    if (_m->Row != m._m->Row || _m->Col != m._m->Col)
@@ -191,5 +191,5 @@
 
 // combined scalar multiplication and assignment operator
- inline Matrix&
+ Matrix&
 Matrix::operator *= (const float& c) 
 {
@@ -202,5 +202,5 @@
 
 // combined Matrix multiplication and assignment operator
- inline Matrix&
+ Matrix&
 Matrix::operator *= (const Matrix& m) 
 {
@@ -223,5 +223,5 @@
 
 // combined scalar division and assignment operator
- inline Matrix&
+ Matrix&
 Matrix::operator /= (const float& c) 
 {
@@ -235,5 +235,5 @@
 
 // combined power and assignment operator
- inline Matrix&
+ Matrix&
 Matrix::operator ^= (const size_t& pow) 
 {
@@ -247,5 +247,5 @@
 
 // unary negation operator
- inline Matrix
+ Matrix
 Matrix::operator - () 
 {
@@ -260,5 +260,5 @@
 
 // binary addition operator
- inline Matrix
+ Matrix
 operator + (const Matrix& m1, const Matrix& m2) 
 {
@@ -269,5 +269,5 @@
 
 // binary subtraction operator
- inline Matrix
+ Matrix
 operator - (const Matrix& m1, const Matrix& m2) 
 {
@@ -278,5 +278,5 @@
 
 // binary scalar multiplication operator
- inline Matrix
+ Matrix
 operator * (const Matrix& m, const float& no) 
 {
@@ -288,5 +288,5 @@
 
 // binary scalar multiplication operator
- inline Matrix
+ Matrix
 operator * (const float& no, const Matrix& m) 
 {
@@ -295,5 +295,5 @@
 
 // binary Matrix multiplication operator
- inline Matrix
+ Matrix
 operator * (const Matrix& m1, const Matrix& m2) 
 {
@@ -304,5 +304,5 @@
 
 // binary scalar division operator
- inline Matrix
+ Matrix
 operator / (const Matrix& m, const float& no) 
 {
@@ -312,5 +312,5 @@
 
 // binary scalar division operator
- inline Matrix
+ Matrix
 operator / (const float& no, const Matrix& m) 
 {
@@ -319,5 +319,5 @@
 
 // binary Matrix division operator
- inline Matrix
+ Matrix
 operator / (const Matrix& m1, const Matrix& m2) 
 {
@@ -326,5 +326,5 @@
 
 // binary power operator
- inline Matrix
+ Matrix
 operator ^ (const Matrix& m, const size_t& pow) 
 {
@@ -335,5 +335,5 @@
 
 // unary transpose operator
- inline Matrix
+ Matrix
 operator ~ (const Matrix& m) 
 {
@@ -350,5 +350,5 @@
 
 // unary inversion operator
- inline Matrix
+ Matrix
 operator ! (const Matrix m) 
 {
@@ -358,5 +358,5 @@
 
 // inversion function
- inline Matrix
+ Matrix
 Matrix::Inv () 
 {
@@ -405,5 +405,5 @@
 
 // solve simultaneous equation
- inline Matrix
+ Matrix
 Matrix::Solve (const Matrix& v) const 
 {
@@ -451,5 +451,5 @@
 
 // set zero to all elements of this Matrix
- inline void
+ void
 Matrix::Null (const size_t& row, const size_t& col) 
 {
@@ -467,5 +467,5 @@
 
 // set zero to all elements of this Matrix
- inline void
+ void
 Matrix::Null() 
 {
@@ -478,5 +478,5 @@
 
 // set this Matrix to unity
- inline void
+ void
 Matrix::Unit (const size_t& row) 
 {
@@ -494,5 +494,5 @@
 
 // set this Matrix to unity
- inline void
+ void
 Matrix::Unit () 
 {
@@ -508,5 +508,5 @@
 
 // private partial pivoting method
- inline int
+ int
 Matrix::pivot (size_t row)
 {
@@ -534,5 +534,5 @@
 
 // calculate the determinant of a Matrix
- inline float
+ float
 Matrix::Det () const 
 {
@@ -565,5 +565,5 @@
 
 // calculate the norm of a Matrix
- inline float
+ float
 Matrix::Norm () 
 {
@@ -579,5 +579,5 @@
 
 // calculate the condition number of a Matrix
- inline float
+ float
 Matrix::Cond () 
 {
@@ -587,5 +587,5 @@
 
 // calculate the cofactor of a Matrix for a given element
- inline float
+ float
 Matrix::Cofact (size_t row, size_t col) 
 {
@@ -622,5 +622,5 @@
 
 // calculate adjoin of a Matrix
- inline Matrix
+ Matrix
 Matrix::Adj () 
 {
@@ -637,5 +637,5 @@
 
 // Determine if the Matrix is singular
- inline bool
+ bool
 Matrix::IsSingular () 
 {
@@ -646,5 +646,5 @@
 
 // Determine if the Matrix is diagonal
- inline bool
+ bool
 Matrix::IsDiagonal () 
 {
@@ -659,5 +659,5 @@
 
 // Determine if the Matrix is scalar
- inline bool
+ bool
 Matrix::IsScalar () 
 {
@@ -672,5 +672,5 @@
 
 // Determine if the Matrix is a unit Matrix
- inline bool
+ bool
 Matrix::IsUnit () 
 {
@@ -681,5 +681,5 @@
 
 // Determine if this is a null Matrix
- inline bool
+ bool
 Matrix::IsNull () 
 {
@@ -692,5 +692,5 @@
 
 // Determine if the Matrix is symmetric
- inline bool
+ bool
 Matrix::IsSymmetric () 
 {
@@ -705,5 +705,5 @@
 	   
 // Determine if the Matrix is skew-symmetric
- inline bool
+ bool
 Matrix::IsSkewSymmetric () 
 {
@@ -718,5 +718,5 @@
    
 // Determine if the Matrix is upper triangular
- inline bool
+ bool
 Matrix::IsUpperTriangular () 
 {
@@ -731,5 +731,5 @@
 
 // Determine if the Matrix is lower triangular
- inline bool
+ bool
 Matrix::IsLowerTriangular () 
 {
Index: /orxonox/branches/parenting/src/matrix.h
===================================================================
--- /orxonox/branches/parenting/src/matrix.h	(revision 3326)
+++ /orxonox/branches/parenting/src/matrix.h	(revision 3327)
@@ -14,5 +14,5 @@
   // Constructors
   Matrix (const Matrix& m);
-  Matrix (size_t row = 6, size_t col = 6);
+  Matrix (size_t row, size_t col);
   
   // Destructor
Index: /orxonox/branches/parenting/src/world.cc
===================================================================
--- /orxonox/branches/parenting/src/world.cc	(revision 3326)
+++ /orxonox/branches/parenting/src/world.cc	(revision 3327)
@@ -153,12 +153,12 @@
 	case DEBUG_WORLD_0:
 	  {
-	    testCurve = new BezierCurve();
-	    testCurve->addNode(Vector(0,0,0));
-	    testCurve->addNode(Vector(5,7,0));
-	    testCurve->addNode(Vector(10,-5,0));
-	    testCurve->addNode(Vector(20, 0,10));
-	    testCurve->addNode(Vector(50, 7,-5));
-	    testCurve->addNode(Vector(60, -20,0));
-	    testCurve->addNode(Vector(60, 10,0));
+	    testCurve = new UPointCurve();
+	    testCurve->addNode(Vector( 0, 0, 0));
+	    testCurve->addNode(Vector(10, 0, 5));
+	    testCurve->addNode(Vector(20, -5,-5));
+	    testCurve->addNode(Vector(30, 5, 10));
+	    testCurve->addNode(Vector(40, 0,-10));
+	    testCurve->addNode(Vector(50, 0,-10));
+
 	    
 	    this->nullParent = NullParent::getInstance ();
@@ -447,9 +447,9 @@
 
   glBegin(GL_LINES);
-  for(float i=0.0; i<1; i+=.01)
-    {
-      printf("%f %f %f\n",testCurve->calcDir(i).x,testCurve->calcDir(i).y,testCurve->calcDir(i).z);
+  for(float i=0.0; i<1; i+=.001)
+    {
+      printf("%f %f %f\n",testCurve->calcPos(i).x,testCurve->calcPos(i).y,testCurve->calcPos(i).z);
       glVertex3f(testCurve->calcPos(i).x, testCurve->calcPos(i).y, testCurve->calcPos(i).z);
-      glVertex3f(testCurve->calcPos(i).x+testCurve->calcDir(i).x, testCurve->calcPos(i).y+testCurve->calcDir(i).y, testCurve->calcPos(i).z+testCurve->calcDir(i).z);
+      //      glVertex3f(testCurve->calcPos(i).x+testCurve->calcDir(i).x, testCurve->calcPos(i).y+testCurve->calcDir(i).y, testCurve->calcPos(i).z+testCurve->calcDir(i).z);
     }
   glEnd();
Index: /orxonox/branches/parenting/src/world.h
===================================================================
--- /orxonox/branches/parenting/src/world.h	(revision 3326)
+++ /orxonox/branches/parenting/src/world.h	(revision 3327)
@@ -67,5 +67,5 @@
 
 
-  BezierCurve* testCurve;
+  UPointCurve* testCurve;
  private:
   Uint32 lastFrame; //!> last time of frame
