Changeset 3375 in orxonox.OLD for orxonox/branches/trackManager/src/curve.cc
- Timestamp:
- Jan 8, 2005, 4:00:29 PM (20 years ago)
- File:
-
- 1 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 ///////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.