Changeset 3813 in orxonox.OLD for orxonox/trunk/src/lib/coord
- Timestamp:
- Apr 13, 2005, 11:12:34 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r3811 r3813 67 67 } 68 68 else 69 this->relCoordinate = new Vector( 0,0,0);69 this->relCoordinate = new Vector(); 70 70 } 71 71 … … 106 106 this->parent = parent; 107 107 this->objectName = NULL; 108 this->time = 1.0; /* set time to 1 to make divisions by zero impossible */ 108 109 109 110 this->absCoordinate = new Vector(); … … 167 168 168 169 169 /** 170 \param absCoord set absolute coordinate 171 172 it is very importand, that you use this function, if you want to update the 173 absCoordinates. If you don't use this, the PNode won't recognize, that something 174 has changed and won't update the children Nodes. 175 */ 176 /* 177 void PNode::setAbsCoor (Vector* absCoord) 178 { 179 this->bAbsCoorChanged = true; 180 *this->absCoordinate = *absCoord; 181 } 182 */ 170 183 171 184 172 … … 217 205 218 206 */ 219 /*220 void PNode::shiftCoor (Vector* shift)221 {222 __UNLIKELY_IF( this->bAbsCoorChanged)223 {224 *this->absCoordinate = *this->absCoordinate + *shift;225 }226 else227 {228 *this->relCoordinate = *this->relCoordinate + *shift;229 this->bRelCoorChanged = true;230 }231 }232 */233 234 235 /**236 \brief shift coordinate (abs and rel)237 \param shift vector238 239 this function shifts the current coordinates about the vector shift. this is240 usefull because from some place else you can:241 PNode* someNode = ...;242 Vector objectMovement = calculateShift();243 someNode->shiftCoor(objectMovement);244 245 elsewhere you would have to:246 PNode* someNode = ...;247 Vector objectMovement = calculateShift();248 Vector currentCoor = someNode->getRelCoor();249 Vector newCoor = currentCoor + objectMovement;250 someNode->setRelCoor(newCoor);251 252 yea right... shorter...253 254 */255 207 void PNode::shiftCoor (const Vector& shift) 256 208 { … … 285 237 has changed and won't update the children Nodes. 286 238 */ 287 /*288 void PNode::setRelDir (Quaternion* relDir)289 {290 this->bRelCoorChanged = true;291 *this->relDirection = *relDir;292 }293 */294 295 296 239 void PNode::setRelDir (const Quaternion& relDir) 297 240 { … … 306 249 */ 307 250 //Quaternion PNode::getAbsDir () const 308 309 310 311 /**312 \brief sets the absolute direction (0,0,1)313 \param absDir absolute coordinates314 315 it is very importand, that you use this function, if you want to update the316 absDirection. If you don't use this, the PNode won't recognize, that something317 has changed and won't update the children Nodes.318 */319 /*320 void PNode::setAbsDir (Quaternion* absDir)321 {322 this->bAbsDirChanged = true;323 *this->absDirection = *absDir;324 }325 */326 251 327 252 … … 371 296 372 297 373 /**374 \brief shift coordinate (abs and rel)375 \param shift vector376 377 this function shifts the current coordinates about the vector shift. this is378 usefull because from some place else you can:379 PNode* someNode = ...;380 Quaternion objectMovement = calculateShift();381 someNode->shiftCoor(objectMovement);382 383 elsewhere you would have to:384 PNode* someNode = ...;385 Quaternion objectMovement = calculateShift();386 Quaternion currentCoor = someNode->getRelCoor();387 Quaternion newCoor = currentCoor + objectMovement;388 someNode->setRelCoor(newCoor);389 390 yea right... shorter...391 392 \todo implement this393 */394 /*395 void PNode::shiftDir (Quaternion* shift)396 {}397 */398 399 298 400 299 /** … … 403 302 float PNode::getSpeed() const 404 303 { 405 __UNLIKELY_IF( this->time == 0)406 return 1000;407 304 *this->diffCoordinate = *this->absCoordinate - *this->lastAbsCoordinate; 408 305 return this->diffCoordinate->len() / this->time; … … 419 316 void PNode::addChild (PNode* pNode, int parentingMode) 420 317 { 421 422 __UNLIKELY_IF( pNode->parent != NULL) 318 __LIKELY_IF( pNode->parent != NULL) 423 319 { 424 320 PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n"); … … 459 355 while( pn != NULL) 460 356 { 461 //this->children->remove(pn);462 357 nullParent->addChild(pn, pn->getMode()); 463 358 pn = iterator->nextElement(); … … 504 399 will force an update of the coordinated of the node. 505 400 */ 401 /* 506 402 void PNode::parentCoorChanged () 507 403 { 508 404 this->bRelCoorChanged = true; 509 405 } 406 */ 510 407 511 408 … … 516 413 will force an update of the direction of the node. 517 414 */ 415 /* 518 416 void PNode::parentDirChanged () 519 417 { 520 418 this->bRelDirChanged = true; 521 419 } 420 */ 522 421 523 422 -
orxonox/trunk/src/lib/coord/p_node.h
r3811 r3813 77 77 78 78 void setParent (PNode* parent); 79 void parentCoorChanged ();80 void parentDirChanged ();79 inline void parentCoorChanged () { this->bRelCoorChanged = true; } 80 inline void parentDirChanged () { this->bRelDirChanged = true; } 81 81 void setMode (int parentingMode); 82 82 int getMode() const;
Note: See TracChangeset
for help on using the changeset viewer.