Index: /orxonox/branches/bezierTrack/src/track.cc
===================================================================
--- /orxonox/branches/bezierTrack/src/track.cc	(revision 3009)
+++ /orxonox/branches/bezierTrack/src/track.cc	(revision 3010)
@@ -17,4 +17,5 @@
 
 #include "track.h"
+  float t = .0;
 
 using namespace std;
@@ -25,23 +26,8 @@
 Track::Track ()
 {
-	ID = 0;
-	offset = NULL;
-	end = NULL;
-	nextID = 0;
-}
+  this->next = NULL;
+  this->previous = NULL;
 
-/**
-	\brief creates a functional base Track part
-	\param number: the ID if this Track part
-	\param next: the ID of the next Track part
-	\param start: pointer to an anchor point (Vector) representing the offset of this part
-	\param finish: pointer to an anchor point (Vector) representing the end of this part
-*/
-Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
-{
-	ID = number;
-	offset = start;
-	end = finish;
-	nextID = next;
+  curve = BezierCurve();
 }
 
@@ -51,4 +37,8 @@
 Track::~Track ()
 {
+  if (next != NULL)
+    delete next;
+  if (previous != NULL)
+    delete previous;
 }
 
@@ -56,4 +46,18 @@
 {
   
+}
+
+void Track::addPoint (Vector& point)
+{
+  curve.addNode(point);
+
+  return;
+}
+
+
+void Track::addHotPoint (Vector& hotPoint)
+{
+
+  return;
 }
 
@@ -70,14 +74,17 @@
 void Track::map_camera (Location* lookat, Placement* camplc)
 {
-  Line trace(*offset, *end - *offset);
-  float l = trace.len ();
+  t+=.001;
+  if (t> 1) t =0;
+  //  Line trace(*offset, *end - *offset);
+  //  float l = trace.len ();
   
-  //	camplc->r = *offset + Vector(0,0,0.5);
-  //	camplc->w = Quaternion (trace.a, Vector(0,0,1));
-  float r = (lookat->dist)*PI / l;
-  camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
-  
+  //  float r = (lookat->dist)*PI / l;
+  // camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
+  camplc->r = curve.calcPos(t) + (curve.calcDir(t)* ((lookat->dist-10)/t)) + Vector(0,0,5.0);
+				 
   Vector w(0.0,0.0,0.0);
-  w=Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r));
+  //  w=Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r));
+  w = Vector(0,0,0) - (((curve.calcPos(t)) + ((curve.calcDir(t)) * ((lookat->dist) / t)) - camplc->r));
+
   //Vector up(0.0,sin(r),cos(r)); // corrupt...
   Vector up(0.0, 0.0, 1.0);
@@ -105,21 +112,21 @@
 bool Track::map_coords (Location* loc, Placement* plc)
 {
-	Line trace(*offset, *end - *offset);
-	float l = trace.len ();
+  //Line trace(*offset, *end - *offset);
+  //	float l = trace.len ();
 	
 	/* change to the next track? */
-	if( loc->dist > l)
-	{
-		loc->dist -= l;
-		loc->part = nextID;
+	//	if( loc->dist > l)
+	//{
+	//	loc->dist -= l;
+	//	loc->part = nextID;
 		//FIXME: loc->track = this;
-		return true;
-	}
+		//return true;
+		//}
 	
 	/* this quaternion represents the rotation from start-vector (0,0,1) to the direction of
 	 * the track */
-	Quaternion dir(trace.a, Vector(0,0,1)); 
+	Quaternion dir(curve.calcDir(t), Vector(0,0,1)); 
 
-	plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos);
+	plc->r = curve.calcPos(t) + (curve.calcDir(t) * ((loc->dist) / t)) + /*dir.apply*/(loc->pos);
 	plc->w = dir * loc->rot;
 	
Index: /orxonox/branches/bezierTrack/src/track.h
===================================================================
--- /orxonox/branches/bezierTrack/src/track.h	(revision 3009)
+++ /orxonox/branches/bezierTrack/src/track.h	(revision 3010)
@@ -20,4 +20,5 @@
   Vector* offset;
   Vector* end;
+  BezierCurve curve;
   // Vector* direction; // unity direction vector: it is costy to always recalculate it
   //Vector* up; // direction where up is ment to be - diffuse in space, eh?
@@ -25,10 +26,15 @@
   Uint32 nextID;
   
+  Track* next;
+  Track* previous;
  	
  public:
   Track ();
-  Track (Uint32 number, Uint32 next, Vector* start, Vector* finish);
+  
   ~Track ();
   virtual void init();
+
+  void addPoint (Vector& point);
+  void addHotPoint (Vector& hotPoint);
   
   virtual void post_enter (WorldEntity* entity);	// handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
Index: /orxonox/branches/bezierTrack/src/vector.cc
===================================================================
--- /orxonox/branches/bezierTrack/src/vector.cc	(revision 3009)
+++ /orxonox/branches/bezierTrack/src/vector.cc	(revision 3010)
@@ -919,5 +919,5 @@
   munk = pow(1-t,(double)nodeCount);
   
-  for (k=0; k<=nodeCount; k++) {
+  for (k=0; k<=nodeCount-1; k++) {
     nn = nodeCount;
     kn = k;
@@ -947,5 +947,5 @@
 }
 
-Vector BezierCurve::calcDirection (float t)
+Vector BezierCurve::calcDir (float t)
 {
   double diff = .00000000001;
Index: /orxonox/branches/bezierTrack/src/vector.h
===================================================================
--- /orxonox/branches/bezierTrack/src/vector.h	(revision 3009)
+++ /orxonox/branches/bezierTrack/src/vector.h	(revision 3010)
@@ -178,5 +178,5 @@
   void addNode (const Vector& newNode);
   Vector calcPos (float t);
-  Vector calcDirection (float t);
+  Vector calcDir (float t);
   
   Vector getPos () const;
Index: /orxonox/branches/bezierTrack/src/world.cc
===================================================================
--- /orxonox/branches/bezierTrack/src/world.cc	(revision 3009)
+++ /orxonox/branches/bezierTrack/src/world.cc	(revision 3010)
@@ -101,16 +101,17 @@
 	    this->pathnodes = new Vector[6];
 	    this->pathnodes[0] = Vector(0, 0, 0);
-	    this->pathnodes[1] = Vector(1000, 0, 0);
-	    //	    this->pathnodes[2] = Vector(-100, 140, 0);
-	    //	    this->pathnodes[3] = Vector(0, 180, 0);
-	    //	    this->pathnodes[4] = Vector(100, 140, 0);
-	    //	    this->pathnodes[5] = Vector(100, 40, 0);
+	    this->pathnodes[1] = Vector(10, 5, 0);
+	    this->pathnodes[2] = Vector(20, 0, 0);
+	    this->pathnodes[3] = Vector(10, 3, 0);
+	    this->pathnodes[4] = Vector(50, 0, 0);
+	    this->pathnodes[5] = Vector(100, 0, 0);
 	    
 	    // create the tracks
-	    this->tracklen = 2;
-	    this->track = new Track[2];
+	    this->tracklen = 5;
+	    this->track = new Track();
 	    for( int i = 0; i < this->tracklen; i++)
 	      {
-		this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
+		//		this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
+		track->addPoint(this->pathnodes[i]);
 	      }
 	    
@@ -152,5 +153,5 @@
 	    for( int i = 0; i < this->tracklen; i++)
 	      {
-		this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
+		//		this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
 	      }
 	    
@@ -428,5 +429,5 @@
     }
 
-  for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
+  //  for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
 }
 
