Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3813 in orxonox.OLD for orxonox/trunk/src/lib/coord


Ignore:
Timestamp:
Apr 13, 2005, 11:12:34 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: finished work on tweaking pnode. pnode is now as fast as it can get:)

Location:
orxonox/trunk/src/lib/coord
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3811 r3813  
    6767  }
    6868  else
    69     this->relCoordinate = new Vector(0,0,0);
     69    this->relCoordinate = new Vector();
    7070}
    7171
     
    106106  this->parent = parent;
    107107  this->objectName = NULL;
     108  this->time = 1.0; /* set time to 1 to make divisions by zero impossible */
    108109
    109110  this->absCoordinate = new Vector();
     
    167168
    168169
    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
    183171
    184172
     
    217205
    218206*/
    219 /*
    220 void PNode::shiftCoor (Vector* shift)
    221 {
    222   __UNLIKELY_IF( this->bAbsCoorChanged)
    223     {
    224       *this->absCoordinate = *this->absCoordinate + *shift;
    225     }
    226   else
    227     {
    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 vector
    238 
    239    this function shifts the current coordinates about the vector shift. this is
    240    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 */
    255207void PNode::shiftCoor (const Vector& shift)
    256208{
     
    285237   has changed and won't update the children Nodes.
    286238*/
    287 /*
    288 void PNode::setRelDir (Quaternion* relDir)
    289 {
    290   this->bRelCoorChanged = true;
    291   *this->relDirection = *relDir;
    292 }
    293 */
    294 
    295 
    296239void PNode::setRelDir (const Quaternion& relDir)
    297240{
     
    306249*/
    307250//Quaternion PNode::getAbsDir () const
    308 
    309 
    310 
    311 /**
    312    \brief sets the absolute direction (0,0,1)
    313    \param absDir absolute coordinates
    314 
    315    it is very importand, that you use this function, if you want to update the
    316    absDirection. If you don't use this, the PNode won't recognize, that something
    317    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 */
    326251
    327252
     
    371296
    372297
    373 /**
    374    \brief shift coordinate (abs and rel)
    375    \param shift vector
    376 
    377    this function shifts the current coordinates about the vector shift. this is
    378    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 this
    393 */
    394 /*
    395 void PNode::shiftDir (Quaternion* shift)
    396 {}
    397 */
    398 
    399298
    400299/**
     
    403302float PNode::getSpeed() const
    404303{
    405   __UNLIKELY_IF( this->time == 0)
    406     return 1000;
    407304  *this->diffCoordinate = *this->absCoordinate - *this->lastAbsCoordinate;
    408305  return this->diffCoordinate->len() / this->time;
     
    419316void PNode::addChild (PNode* pNode, int parentingMode)
    420317{
    421 
    422   __UNLIKELY_IF( pNode->parent != NULL)
     318  __LIKELY_IF( pNode->parent != NULL)
    423319    {
    424320      PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n");
     
    459355  while( pn != NULL)
    460356    {
    461       //this->children->remove(pn);
    462357      nullParent->addChild(pn, pn->getMode());
    463358      pn = iterator->nextElement();
     
    504399   will force an update of the coordinated of the node.
    505400*/
     401/*
    506402void PNode::parentCoorChanged ()
    507403{
    508404  this->bRelCoorChanged = true;
    509405}
     406*/
    510407
    511408
     
    516413   will force an update of the direction of the node.
    517414*/
     415/*
    518416void PNode::parentDirChanged ()
    519417{
    520418  this->bRelDirChanged = true;
    521419}
     420*/
    522421
    523422
  • orxonox/trunk/src/lib/coord/p_node.h

    r3811 r3813  
    7777
    7878  void setParent (PNode* parent);
    79   void parentCoorChanged ();
    80   void parentDirChanged ();
     79  inline void parentCoorChanged () { this->bRelCoorChanged = true; }
     80  inline void parentDirChanged () { this->bRelDirChanged = true; }
    8181  void setMode (int parentingMode);
    8282  int getMode() const;
Note: See TracChangeset for help on using the changeset viewer.