Changeset 3375 in orxonox.OLD for orxonox/branches
- Timestamp:
- Jan 8, 2005, 4:00:29 PM (20 years ago)
- Location:
- orxonox/branches/trackManager/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/trackManager/src/curve.cc
r3374 r3375 40 40 } 41 41 currentNode->position = newNode; 42 currentNode->next = 0; // not sure if this really points to NULL!!42 currentNode->next = 0; 43 43 currentNode->number = (++nodeCount); 44 this->rebuild(); 45 return; 46 } 47 48 void Curve::addNode(const Vector& newNode, unsigned int insertPosition) 49 { 50 51 if (this->nodeCount == 0 || insertPosition > this->nodeCount) 52 return addNode(newNode); 53 54 if (insertPosition == 0) 55 insertPosition = 1; 56 57 PathNode* insNode = new PathNode; 58 59 // relinking 60 PathNode* tmpNode = this->firstNode; 61 if (insertPosition > 1) 62 { 63 while (tmpNode->next->number != insertPosition) 64 tmpNode= tmpNode->next; 65 insNode->next = tmpNode->next; 66 tmpNode->next = insNode; 67 } 68 else 69 { 70 insNode->next = this->firstNode; 71 this->firstNode = insNode; 72 } 73 // renumbering 74 insNode->number = insertPosition; 75 tmpNode = insNode->next; 76 while (tmpNode) 77 { 78 tmpNode->number++; 79 tmpNode = tmpNode->next; 80 } 81 82 // finished 83 insNode->position = newNode; 84 ++nodeCount; 44 85 this->rebuild(); 45 86 return; … … 60 101 return tmpNode->position; 61 102 } 103 104 /** 105 \brief Outputs information about the state of this Curve 106 */ 107 void Curve::debug(void) 108 { 109 printf("<<-------------------------------\n"); 110 printf("Curve Information:\n"); 111 printf("NodeCount: %d\n", this->nodeCount); 112 PathNode* tmpNode = this->firstNode; 113 while (tmpNode) 114 { 115 printf("node #%d: %f, %f, %f\n", tmpNode->number, tmpNode->position.x, tmpNode->position.y, tmpNode->position.z); 116 tmpNode = tmpNode->next; 117 } 118 printf("------------------------------->>\n"); 119 } 120 62 121 63 122 /////////////////////////////////// -
orxonox/branches/trackManager/src/curve.h
r3374 r3375 43 43 Curve* dirCurve; //!< The derivation-curve of this Curve. 44 44 void addNode(const Vector& newNode); 45 void addNode(const Vector& newNode, unsigned int insertPosition); 45 46 Vector getNode(unsigned int nodeToFind); 46 47 inline int getNodeCount(void) { return this->nodeCount;} … … 51 52 virtual Quaternion calcQuat(float t) = 0; 52 53 54 // DEBUG 55 void debug(void); 53 56 }; 54 57 -
orxonox/branches/trackManager/src/track_manager.cc
r3374 r3375 466 466 { 467 467 Vector tmp = this->calcPos(); 468 Quaternion quat = Quaternion(this->calcDir(), Vector( 0,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z));468 Quaternion quat = Quaternion(this->calcDir(), Vector(this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).x,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z)); 469 469 this->bindSlave->setAbsCoor(&tmp); 470 470 this->bindSlave->setAbsDir(&quat); -
orxonox/branches/trackManager/src/world.cc
r3374 r3375 230 230 231 231 /* 232 tmpCurve->addNode(Vector(10,0,-10)); 233 //tmpCurve->addNode(Vector(10,2,5)); 234 //tmpCurve->addNode(Vector(10,3,-5)); 235 // tmpCurve->addNode(Vector(10,1,5)); 236 tmpCurve->addNode(Vector(10,0,5)); 232 tmpCurve->addNode(Vector(10, -1, -1)); 233 tmpCurve->addNode(Vector(10, -2, 2)); 234 tmpCurve->addNode(Vector(10, 3, 3)); 235 tmpCurve->addNode(Vector(10, 4, -4), 0); 236 tmpCurve->addNode(Vector(10, -1, -1)); 237 tmpCurve->addNode(Vector(10, -2, 2)); 238 tmpCurve->addNode(Vector(10, 3, 3)); 239 tmpCurve->addNode(Vector(10, 4, -4), 0); 240 tmpCurve->debug(); 237 241 */ 238 242 switch(this->debugWorldNr) … … 509 513 trackManager->drawGraph(.01); 510 514 trackManager->debug(2); 511 512 /* 515 /* 513 516 glBegin(GL_LINES); 514 517 float i;
Note: See TracChangeset
for help on using the changeset viewer.