Index: orxonox/branches/parenting/src/curve.cc
===================================================================
--- orxonox/branches/parenting/src/curve.cc	(revision 3354)
+++ orxonox/branches/parenting/src/curve.cc	(revision 3355)
@@ -164,26 +164,29 @@
    \param t The position on the Curve (0<=t<=1)
    \return the Position on the Path
-   \todo implement nodeCount 0,1,2,3
 */
 Vector BezierCurve::calcPos(float t) 
 {
-  if (nodeCount < 4)
-    {
-      //    if (verbose >= 1)
-      //      printf ("Please define at least 4 nodes, until now you have only defined %i.\n", nodeCount);
-      return Vector(0,0,0);
-    }
-  PathNode* tmpNode = firstNode;
   Vector ret = Vector(0.0,0.0,0.0);
-  double factor = pow(1.0-t,nodeCount-1);
-  while(tmpNode)
-    {
-      ret.x += tmpNode->factor * factor * tmpNode->position.x;
-      ret.y += tmpNode->factor * factor * tmpNode->position.y;
-      ret.z += tmpNode->factor * factor * tmpNode->position.z;
-      factor *= t/(1.0-t); // same as pow but much faster.
-
-      tmpNode = tmpNode->next;
-    }
+  if (this->nodeCount >= 3)
+    {
+      PathNode* tmpNode = this->firstNode;
+      double factor = pow(1.0-t,nodeCount-1);
+      while(tmpNode)
+	{
+	  ret.x += tmpNode->factor * factor * tmpNode->position.x;
+	  ret.y += tmpNode->factor * factor * tmpNode->position.y;
+	  ret.z += tmpNode->factor * factor * tmpNode->position.z;
+	  factor *= t/(1.0-t); // same as pow but much faster.
+	  
+	  tmpNode = tmpNode->next;
+	}
+    }
+  else if (nodeCount == 2)
+    {
+      ret = this->firstNode->position *(1.0-t);
+      ret = ret + this->firstNode->next->position * t;
+    }
+  else if (nodeCount == 1)
+    ret = this->firstNode->position;
   return ret;
 }
Index: orxonox/branches/parenting/src/track_manager.cc
===================================================================
--- orxonox/branches/parenting/src/track_manager.cc	(revision 3354)
+++ orxonox/branches/parenting/src/track_manager.cc	(revision 3355)
@@ -180,6 +180,11 @@
 void TrackManager::workOn(unsigned int trackID)
 {
-  this->currentTrackElem = findTrackElementByID(trackID);
-  printf("now Working on %d\n", trackID);
+  TrackElement* tmpElem = findTrackElementByID(trackID);
+  if (tmpElem)
+    this->currentTrackElem = tmpElem;
+  else
+    printf("TrackElement not Found, leaving unchanged\n");
+  printf("now Working on %d\n", this->currentTrackElem->ID);
+
 }
 
Index: orxonox/branches/parenting/src/world.cc
===================================================================
--- orxonox/branches/parenting/src/world.cc	(revision 3354)
+++ orxonox/branches/parenting/src/world.cc	(revision 3355)
@@ -244,6 +244,6 @@
       trackManager->addPoint(Vector(150,0,-10));
       trackManager->setDuration(.5);
-      int fork11, fork12;
-      trackManager->fork(2, &fork11, &fork12);
+      int fork11, fork12, fork13;
+      trackManager->fork(3, &fork11, &fork12, &fork13);
       trackManager->workOn(fork11);
       trackManager->addPoint(Vector(170, 0, -15));
@@ -254,16 +254,27 @@
       trackManager->addPoint(Vector(190,2,5));
       trackManager->addPoint(Vector(200,2,5));
-      trackManager->setSavePoint();
+      int fork21, fork22;
+      trackManager->fork(2, &fork21, &fork22);
+      trackManager->workOn(fork21);
       trackManager->addPoint(Vector(220, 10,-10));
       trackManager->addPoint(Vector(230, 0,-10));
       trackManager->addPoint(Vector(240, 0, 2));
       trackManager->addPoint(Vector(250, 0, 0));
+      trackManager->addPoint(Vector(260, 0, 5));
       trackManager->join(2, fork12, fork11);
-      
+      trackManager->workOn(fork22);
+      trackManager->addPoint(Vector(220, -10,10));
+      trackManager->addPoint(Vector(230, 0, 10));
+      trackManager->addPoint(Vector(240, 0, 10));
+      trackManager->addPoint(Vector(250, 0, 5));
+      trackManager->workOn(fork13);
+      trackManager->addPoint(Vector(200,-10,5));
+      trackManager->addPoint(Vector(250,-10,5));
+      trackManager->join(3, fork21, fork22, fork13);
       /*
       tmpCurve->addNode(Vector(10,0,-10));
-      tmpCurve->addNode(Vector(10,2,5));
-      tmpCurve->addNode(Vector(10,3,-5));
-      tmpCurve->addNode(Vector(10,1,5));
+      //tmpCurve->addNode(Vector(10,2,5));
+      //tmpCurve->addNode(Vector(10,3,-5));
+      //      tmpCurve->addNode(Vector(10,1,5));
       tmpCurve->addNode(Vector(10,0,5));
       */
@@ -563,5 +574,5 @@
     }
   glEnd();
-
+  
   /*
   glBegin(GL_LINE_STRIP);
@@ -576,4 +587,6 @@
   trackManager->drawGraph(.01);
   trackManager->debug(2);
+  //  delete trackManager;
+  
   /*
   glBegin(GL_LINES);
@@ -584,6 +597,6 @@
       glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
     }
+  glEnd();
   */
-  glEnd();
   glEndList();
 }
