Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3016 in orxonox.OLD for orxonox/branches/bezierTrack/src


Ignore:
Timestamp:
Nov 27, 2004, 6:12:42 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/bezierTrack: now the Track-direction is what it should be, but it looks somehow funny…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/bezierTrack/src/vector.cc

    r3015 r3016  
    2121
    2222#include "vector.h"
    23 
     23#include <fstream>
    2424
    2525using namespace std;
     
    928928   
    929929    tmpNode = tmpNode->next;
     930
    930931    }
    931932  return ret;
     
    934935Vector BezierCurve::calcDir (float t)
    935936{
    936   double diff = .00000000001;
    937  
    938   Vector diffV = ((calcPos(t+diff) - calcPos(t))/diff);
    939   diffV.normalize();
    940   return diffV;
     937  PathNode* tmpNode = firstNode;
     938  BezierCurve* tmpCurve = new BezierCurve();
     939  Vector ret;
     940  Vector tmpVector;
     941
     942  while (tmpNode->next != 0)
     943    {
     944      tmpVector = (tmpNode->next->position)- (tmpNode->position);
     945      tmpVector.x*=(float)nodeCount;
     946      tmpVector.y*=(float)nodeCount;
     947      tmpVector.z*=(float)nodeCount;
     948
     949      tmpCurve->addNode(tmpVector);
     950      tmpNode = tmpNode->next;
     951    }
     952  ret = tmpCurve->calcPos(t);
     953  ret.normalize();
     954
     955  return ret;
    941956}
    942957
Note: See TracChangeset for help on using the changeset viewer.