Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3349 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 6, 2005, 3:39:28 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: :TrackManager: curves are now being added in a C1-static maner (at least for bezier).

Location:
orxonox/branches/parenting/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/curve.cc

    r3348 r3349  
    4646}
    4747
     48/**
     49   \brief Finds a Node by its Number, and returns its Position
     50   \param nodeToFind the n'th node in the List of nodes
     51   \returns A Vector to the Position of the Node.
     52*/
     53Vector Curve::getNode(unsigned int nodeToFind)
     54{
     55  if (nodeToFind > this->nodeCount)
     56    return Vector(0,0,0);
     57  PathNode* tmpNode = this->firstNode;
     58  for (int i = 1; i < nodeToFind; i++)
     59    tmpNode = tmpNode->next;
     60  return tmpNode->position;
     61}
    4862
    4963///////////////////////////////////
  • orxonox/branches/parenting/src/curve.h

    r3331 r3349  
    4242  virtual void rebuild(void) = 0;
    4343 public:
    44   void addNode (const Vector& newNode);
     44  void addNode(const Vector& newNode);
     45  Vector getNode(unsigned int nodeToFind);
     46  inline int getNodeCount(void) { return this->nodeCount;}
    4547
    4648  virtual Vector calcPos(float t) = 0;
  • orxonox/branches/parenting/src/track_manager.cc

    r3348 r3349  
    4040  this->childCount = 0;
    4141  this->name = NULL;
     42  this->startPoint = Vector(0,0,0);
     43  this->startTangentPoint = Vector(0,0,0);
    4244  this->curve = NULL;
    4345  this->children = NULL;
     
    154156      this->currentTrackElem->children[i]->ID = ++trackElemCount;
    155157      this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->startingTime+this->currentTrackElem->duration;
     158      this->currentTrackElem->children[i]->startPoint = this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount());
     159      this->currentTrackElem->children[i]->startTangentPoint = (this->currentTrackElem->children[i]->startPoint *2) - this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()-1);
    156160    }
    157161}
     
    221225      this->setCurveType(BEZIERCURVE);
    222226      this->currentTrackElem->isFresh = false;
     227      if(this->currentTrackElem != this->firstTrackElem)
     228        this->addPoint(this->currentTrackElem->startPoint);
     229        this->addPoint(this->currentTrackElem->startTangentPoint);
     230     
    223231    }
    224232  this->currentTrackElem->curve->addNode(newPoint);
  • orxonox/branches/parenting/src/track_manager.h

    r3335 r3349  
    4646  int nodeCount;             //!< The count of points this TrackElement has.
    4747  char* name;                //!< A name for the Trac.
     48  Vector startPoint;         //!< A Vector that Points to the first point of the containing Curve. (for c1-steadiness)
     49  Vector startTangentPoint;  //!< A Vector that points into the direction of the previous Curve. (for c1-steadiness)
    4850  Curve* curve;              //!< The Curve of this TrackElement
    4951  int childCount;            //!< The number of Children This TrackElement has.
Note: See TracChangeset for help on using the changeset viewer.