Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 20, 2005, 10:38:59 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: stdincl was still included everywhere. removed it out of the stdincl.h file to enable the possibility of compile-speedup. added some testclasses for vector/quaternion.

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

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/helper_parent.h

    r3544 r3607  
    88#define _HELPER_PARENT_H
    99
    10 #include "stdincl.h"
     10
    1111#include "p_node.h"
    1212
  • orxonox/trunk/src/lib/coord/null_parent.cc

    r3591 r3607  
    1919
    2020#include "null_parent.h"
     21#include "stdincl.h"
    2122
    2223
     
    5152  this->parent = this;
    5253  this->mode = PNODE_ALL;
    53   this->absCoordinate = *absCoordinate;
     54  *this->absCoordinate = *absCoordinate;
    5455  this->setName("NullParent");
    5556}
     
    7778{
    7879
    79   PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    80   this->absCoordinate = this->relCoordinate;
    81   this->absDirection = parent->getAbsDir () * this->relDirection;
     80  PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z);
     81  *this->absCoordinate = *this->relCoordinate;
     82  *this->absDirection = parent->getAbsDir () * *this->relDirection;
    8283 
    8384  PNode* pn = this->children->enumerate ();
  • orxonox/trunk/src/lib/coord/null_parent.h

    r3552 r3607  
    88#define _NULL_PARENT_H
    99
    10 #include "stdincl.h"
     10
    1111#include "p_node.h"
    1212
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3591 r3607  
    2121
    2222#include "p_node.h"
     23#include "stdincl.h"
    2324
    2425#include "null_parent.h"
    25 #include "vector.h"
     26//#include "vector.h"
     27//#include "quaternion.h"
    2628
    2729using namespace std;
     
    5153  this->init(parent);
    5254
    53   this->absCoordinate = *absCoordinate;
     55  *this->absCoordinate = *absCoordinate;
    5456  if (parent != NULL)
    5557    {
    56       this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     58      *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    5759      parent->addChild (this);
    5860    }
    5961  else
    60     this->relCoordinate = Vector(0,0,0);
     62    this->relCoordinate = new Vector(0,0,0);
    6163}
    6264
     
    9294}
    9395
     96
    9497void PNode::init(PNode* parent)
    9598{
     
    101104  this->parent = parent;
    102105  this->objectName = NULL;
     106
     107  this->absCoordinate = new Vector();
     108  this->relCoordinate = new Vector();
     109  this->absDirection = new Quaternion();
     110  this->relDirection = new Quaternion();
    103111}
    104112
     
    130138Vector PNode::getRelCoor ()
    131139{
    132   Vector r = this->relCoordinate; /* return a copy, so it can't be modified */
     140  Vector r = *this->relCoordinate; /* return a copy, so it can't be modified */
    133141  return r;
    134142}
     
    146154{
    147155  this->bRelCoorChanged = true;
    148   this->relCoordinate = *relCoord;
     156  *this->relCoordinate = *relCoord;
    149157}
    150158
     
    156164Vector PNode::getAbsCoor ()
    157165{
    158   return this->absCoordinate;
     166  return *this->absCoordinate;
    159167}
    160168
     
    170178{
    171179  this->bAbsCoorChanged = true;
    172   this->absCoordinate = *absCoord;
     180  *this->absCoordinate = *absCoord;
    173181}
    174182
     
    198206  if( this->bAbsCoorChanged)
    199207    {
    200       this->absCoordinate = this->absCoordinate + *shift;
     208      *this->absCoordinate = *this->absCoordinate + *shift;
    201209    }
    202210  else
    203211    {
    204       this->relCoordinate = this->relCoordinate + *shift;
     212      *this->relCoordinate = *this->relCoordinate + *shift;
    205213      this->bRelCoorChanged = true;
    206214    }
     
    215223Quaternion PNode::getRelDir ()
    216224{
    217   return this->relDirection;
     225  return *this->relDirection;
    218226}
    219227
     
    230238{
    231239  this->bRelCoorChanged = true;
    232   this->relDirection = *relDir;
     240  *this->relDirection = *relDir;
    233241}
    234242
     
    240248Quaternion PNode::getAbsDir ()
    241249{
    242   return this->absDirection;
     250  return *this->absDirection;
    243251}
    244252
     
    255263{
    256264  this->bAbsDirChanged = true;
    257   this->absDirection = *absDir;
     265  *this->absDirection = *absDir;
    258266}
    259267
     
    410418void PNode::update ()
    411419{
    412   PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
     420  PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z);
    413421  // printf("%s", this->objectName);
    414422  if(this->mode & PNODE_MOVEMENT )
     
    417425        {
    418426          /* if you have set the absolute coordinates this overrides all other changes */
    419           this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     427          *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    420428        }
    421429      else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     
    424432          if( this->parent == NULL)
    425433            {
    426               this->absCoordinate = this->relCoordinate;
     434              *this->absCoordinate = *this->relCoordinate;
    427435            }
    428436          else
    429             this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;         /* update the current absCoordinate */
     437            *this->absCoordinate = parent->getAbsCoor() + *this->relCoordinate;       /* update the current absCoordinate */
    430438        }
    431439    }
     
    436444        {
    437445          /* if you have set the absolute coordinates this overrides all other changes */
    438           this->relDirection = this->absDirection - parent->getAbsDir();
     446          *this->relDirection = *this->absDirection - parent->getAbsDir();
    439447        }
    440448      else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
    441449        {
    442450          /* update the current absDirection - remember * means rotation around sth.*/
    443           this->absDirection = parent->getAbsDir() * this->relDirection;
     451          *this->absDirection = parent->getAbsDir() * *this->relDirection;
    444452        }
    445453    }
     
    450458        {
    451459          /* if you have set the absolute coordinates this overrides all other changes */
    452           this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     460          *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    453461        }
    454462      else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     
    456464          /*this is bad style... must be deleted later - just for testing*/
    457465          if( this->parent == NULL)
    458             this->absCoordinate = this->relCoordinate;
     466            *this->absCoordinate = *this->relCoordinate;
    459467          else
    460             this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate);              /* update the current absCoordinate */
     468            *this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(*this->relCoordinate);            /* update the current absCoordinate */
    461469        }
    462470    }
     
    505513{
    506514  PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n",
    507          this->absCoordinate.x,
    508          this->absCoordinate.y,
    509          this->absCoordinate.z);
     515         this->absCoordinate->x,
     516         this->absCoordinate->y,
     517         this->absCoordinate->z);
    510518}
    511519
  • orxonox/trunk/src/lib/coord/p_node.h

    r3565 r3607  
    2323
    2424#include "base_object.h"
     25#include "vector.h"
    2526
    2627// FORWARD DEFINITION \\
     
    2829class Quaternion;
    2930class Vector;
     31template<class T> class tList;
    3032
    3133//! enumeration for the different translation-binding-types
     
    102104  bool bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
    103105
    104   Vector relCoordinate;    //!< coordinates relative to the parent
    105   Vector absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
    106   Quaternion relDirection; //!< direction relative to the parent
    107   Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
     106  Vector* relCoordinate;    //!< coordinates relative to the parent
     107  Vector* absCoordinate;    //!< absolute coordinates in the world ( from (0,0,0) )
     108  Quaternion* relDirection; //!< direction relative to the parent
     109  Quaternion* absDirection; //!< absolute direvtion in the world ( from (0,0,1) )
    108110
    109111  int mode;                //!< the mode of the binding
Note: See TracChangeset for help on using the changeset viewer.