- Timestamp:
- Jan 6, 2005, 3:39:28 AM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/curve.cc
r3348 r3349 46 46 } 47 47 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 */ 53 Vector 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 } 48 62 49 63 /////////////////////////////////// -
orxonox/branches/parenting/src/curve.h
r3331 r3349 42 42 virtual void rebuild(void) = 0; 43 43 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;} 45 47 46 48 virtual Vector calcPos(float t) = 0; -
orxonox/branches/parenting/src/track_manager.cc
r3348 r3349 40 40 this->childCount = 0; 41 41 this->name = NULL; 42 this->startPoint = Vector(0,0,0); 43 this->startTangentPoint = Vector(0,0,0); 42 44 this->curve = NULL; 43 45 this->children = NULL; … … 154 156 this->currentTrackElem->children[i]->ID = ++trackElemCount; 155 157 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); 156 160 } 157 161 } … … 221 225 this->setCurveType(BEZIERCURVE); 222 226 this->currentTrackElem->isFresh = false; 227 if(this->currentTrackElem != this->firstTrackElem) 228 this->addPoint(this->currentTrackElem->startPoint); 229 this->addPoint(this->currentTrackElem->startTangentPoint); 230 223 231 } 224 232 this->currentTrackElem->curve->addNode(newPoint); -
orxonox/branches/parenting/src/track_manager.h
r3335 r3349 46 46 int nodeCount; //!< The count of points this TrackElement has. 47 47 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) 48 50 Curve* curve; //!< The Curve of this TrackElement 49 51 int childCount; //!< The number of Children This TrackElement has.
Note: See TracChangeset
for help on using the changeset viewer.