Index: /orxonox/branches/parenting/src/curve.cc
===================================================================
--- /orxonox/branches/parenting/src/curve.cc	(revision 3320)
+++ /orxonox/branches/parenting/src/curve.cc	(revision 3321)
@@ -50,13 +50,17 @@
 BezierCurve::BezierCurve (void)
 {
-  nodeCount = 0;
-  firstNode = new PathNode;
-  currentNode = firstNode;
+  this->derivation = 0;
+  dirCurve = new BezierCurve(1);
+  this->init();
+}
 
-  firstNode->position = Vector (.0, .0, .0);
-  firstNode->number = 0;
-  firstNode->next = 0; // not sure if this really points to NULL!!
-
-  return;
+/**
+   \brief Creates a new BezierCurve-Derivation-Curve
+*/
+BezierCurve::BezierCurve (int derivation)
+{
+  this->derivation = derivation;
+  dirCurve=NULL;
+  this->init();
 }
 
@@ -76,4 +80,22 @@
       delete tmpNode;
     }
+  if (dirCurve)
+    delete dirCurve;
+}
+
+/**
+   \brief Initializes a BezierCurve
+*/
+void BezierCurve::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;
 }
 
@@ -85,4 +107,5 @@
   PathNode* tmpNode = firstNode;
 
+  // rebuilding the Curve itself
   int k=0;
   int binCoef = 1;
@@ -96,4 +119,22 @@
       tmpNode->factor = binCoef;
       tmpNode = tmpNode->next;
+    }
+
+  // rebuilding the Derivation curve
+  if(this->derivation == 0)
+    {
+      tmpNode = firstNode;
+      delete dirCurve;
+      dirCurve = new BezierCurve(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;
+	}
     }
 }
@@ -134,23 +175,5 @@
 Vector BezierCurve::calcDir (float t)
 {
-  PathNode* tmpNode = firstNode;
-  BezierCurve* tmpCurve = new BezierCurve();
-  Vector ret;
-  Vector tmpVector;
-
-  while (tmpNode->next != 0)
-    {
-      tmpVector = (tmpNode->next->position)- (tmpNode->position);
-      tmpVector.x*=(float)nodeCount;
-      tmpVector.y*=(float)nodeCount;
-      tmpVector.z*=(float)nodeCount;
-
-      tmpCurve->addNode(tmpVector);
-      tmpNode = tmpNode->next;
-    }
-  ret = tmpCurve->calcPos(t);
-  ret.normalize();
-
-  return ret;
+  return static_cast<BezierCurve*>(dirCurve)->calcPos(t);
 }
 
Index: /orxonox/branches/parenting/src/curve.h
===================================================================
--- /orxonox/branches/parenting/src/curve.h	(revision 3320)
+++ /orxonox/branches/parenting/src/curve.h	(revision 3321)
@@ -20,4 +20,6 @@
   Vector curvePoint;     //!< The point on the Cureve at a local Time.
   float localTime;       //!< If the time of one point is asked more than once the programm will not calculate it again.
+  Curve* dirCurve;       //!< The derivation-curve of this Curve.
+  int derivation;        //!< Which derivation of a Curve is this.
 
   //! Handles the curve-points (dynamic List)
@@ -52,5 +54,7 @@
  public:
   BezierCurve(void);
+  BezierCurve(int derivation);
   ~BezierCurve(void);
+  void init(void);
 
   Vector calcPos(float t);
Index: /orxonox/branches/parenting/src/world.cc
===================================================================
--- /orxonox/branches/parenting/src/world.cc	(revision 3320)
+++ /orxonox/branches/parenting/src/world.cc	(revision 3321)
@@ -159,4 +159,6 @@
 	    testCurve->addNode(Vector(20, 0,10));
 	    testCurve->addNode(Vector(50, 7,-5));
+	    testCurve->addNode(Vector(60, -20,0));
+	    testCurve->addNode(Vector(60, 10,0));
 	    
 	    this->nullParent = NullParent::getInstance ();
@@ -448,5 +450,7 @@
   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);
       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);
     }
   glEnd();
