Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3017 in orxonox.OLD for orxonox/branches/bezierTrack


Ignore:
Timestamp:
Nov 27, 2004, 8:18:01 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/bezierTrack: fixed small error with k++, ++k.

Location:
orxonox/branches/bezierTrack/src
Files:
3 edited

Legend:

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

    r3015 r3017  
    8383void Track::map_camera (Location* lookat, Placement* camplc)
    8484{
    85   t+=.0001;
    86   if (t> 1) t =0;
    8785  //  Line trace(*offset, *end - *offset);
    8886  //  float l = trace.len ();
     
    120118bool Track::map_coords (Location* loc, Placement* plc)
    121119{
     120  t+=.0001;
     121  if (t > 1) t =0;
     122  //  printf ("Pos: %f, %f, %f\n", curve.calcPos(t).x, curve.calcPos(t).y, curve.calcPos(t).z);
    122123  //Line trace(*offset, *end - *offset);
    123124  //    float l = trace.len ();
  • orxonox/branches/bezierTrack/src/vector.cc

    r3016 r3017  
    883883void BezierCurve::addNode(const Vector& newNode)
    884884{
    885   PathNode* tmpNode;
    886   if (nodeCount == 0 )
    887     tmpNode = firstNode;
    888   else
     885  if (nodeCount != 0 )
    889886    {
    890       tmpNode = new PathNode;
    891       currentNode = currentNode->next = tmpNode;
     887      currentNode = currentNode->next = new PathNode;
    892888    }
    893   tmpNode->position = newNode;
    894   tmpNode->next = 0; // not sure if this really points to NULL!!
    895   tmpNode->number = (++nodeCount);
     889  currentNode->position = newNode;
     890  currentNode->next = 0; // not sure if this really points to NULL!!
     891  currentNode->number = (++nodeCount);
    896892  return;
    897893}
     
    908904      //      if (verbose >= 1)
    909905      //      printf ("Please define at least 4 nodes, until now you have only defined %i.\n", nodeCount);
    910       curvePoint = Vector(0,0,0);
     906      return Vector(0,0,0);
    911907    }
    912908  PathNode* tmpNode = firstNode;
     
    914910  Vector ret = Vector(0.0,0.0,0.0);
    915911  double factor;
    916  
    917   for (int k=0; k < nodeCount; k++)
     912  int k=0;
     913  while(tmpNode!=0)
    918914    {
     915      k++;
    919916      factor = ncr (nodeCount, k);
    920917     
     
    926923      ret.y += factor * tmpNode->position.y;
    927924      ret.z += factor * tmpNode->position.z;
    928    
    929     tmpNode = tmpNode->next;
     925     
     926      tmpNode = tmpNode->next;
    930927
    931928    }
     
    953950  ret.normalize();
    954951
    955   return ret;
     952  return Vector (0,0,0);//ret;
    956953}
    957954
  • orxonox/branches/bezierTrack/src/world.cc

    r3014 r3017  
    106106            track->addPoint (Vector(10, 5, 0));
    107107            track->addPoint (Vector(20, 0, 0));
    108             track->addPoint (Vector(10, 3, 0));
    109             track->addPoint (Vector(50, 0, 0));
    110             track->addPoint (Vector(0, 0, 0));
     108            track->addPoint (Vector(30, -10, 0));
     109            track->addPoint (Vector(40, 5, 0));
     110            track->addPoint (Vector(60, -10, 0));
    111111           
    112112           
Note: See TracChangeset for help on using the changeset viewer.