Changeset 3607 in orxonox.OLD for orxonox/trunk/src/lib/coord
- Timestamp:
- Mar 20, 2005, 10:38:59 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/coord
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/helper_parent.h
r3544 r3607 8 8 #define _HELPER_PARENT_H 9 9 10 #include "stdincl.h" 10 11 11 #include "p_node.h" 12 12 -
orxonox/trunk/src/lib/coord/null_parent.cc
r3591 r3607 19 19 20 20 #include "null_parent.h" 21 #include "stdincl.h" 21 22 22 23 … … 51 52 this->parent = this; 52 53 this->mode = PNODE_ALL; 53 this->absCoordinate = *absCoordinate;54 *this->absCoordinate = *absCoordinate; 54 55 this->setName("NullParent"); 55 56 } … … 77 78 { 78 79 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; 82 83 83 84 PNode* pn = this->children->enumerate (); -
orxonox/trunk/src/lib/coord/null_parent.h
r3552 r3607 8 8 #define _NULL_PARENT_H 9 9 10 #include "stdincl.h" 10 11 11 #include "p_node.h" 12 12 -
orxonox/trunk/src/lib/coord/p_node.cc
r3591 r3607 21 21 22 22 #include "p_node.h" 23 #include "stdincl.h" 23 24 24 25 #include "null_parent.h" 25 #include "vector.h" 26 //#include "vector.h" 27 //#include "quaternion.h" 26 28 27 29 using namespace std; … … 51 53 this->init(parent); 52 54 53 this->absCoordinate = *absCoordinate;55 *this->absCoordinate = *absCoordinate; 54 56 if (parent != NULL) 55 57 { 56 this->relCoordinate =this->absCoordinate - parent->getAbsCoor ();58 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 57 59 parent->addChild (this); 58 60 } 59 61 else 60 this->relCoordinate = Vector(0,0,0);62 this->relCoordinate = new Vector(0,0,0); 61 63 } 62 64 … … 92 94 } 93 95 96 94 97 void PNode::init(PNode* parent) 95 98 { … … 101 104 this->parent = parent; 102 105 this->objectName = NULL; 106 107 this->absCoordinate = new Vector(); 108 this->relCoordinate = new Vector(); 109 this->absDirection = new Quaternion(); 110 this->relDirection = new Quaternion(); 103 111 } 104 112 … … 130 138 Vector PNode::getRelCoor () 131 139 { 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 */ 133 141 return r; 134 142 } … … 146 154 { 147 155 this->bRelCoorChanged = true; 148 this->relCoordinate = *relCoord;156 *this->relCoordinate = *relCoord; 149 157 } 150 158 … … 156 164 Vector PNode::getAbsCoor () 157 165 { 158 return this->absCoordinate;166 return *this->absCoordinate; 159 167 } 160 168 … … 170 178 { 171 179 this->bAbsCoorChanged = true; 172 this->absCoordinate = *absCoord;180 *this->absCoordinate = *absCoord; 173 181 } 174 182 … … 198 206 if( this->bAbsCoorChanged) 199 207 { 200 this->absCoordinate =this->absCoordinate + *shift;208 *this->absCoordinate = *this->absCoordinate + *shift; 201 209 } 202 210 else 203 211 { 204 this->relCoordinate =this->relCoordinate + *shift;212 *this->relCoordinate = *this->relCoordinate + *shift; 205 213 this->bRelCoorChanged = true; 206 214 } … … 215 223 Quaternion PNode::getRelDir () 216 224 { 217 return this->relDirection;225 return *this->relDirection; 218 226 } 219 227 … … 230 238 { 231 239 this->bRelCoorChanged = true; 232 this->relDirection = *relDir;240 *this->relDirection = *relDir; 233 241 } 234 242 … … 240 248 Quaternion PNode::getAbsDir () 241 249 { 242 return this->absDirection;250 return *this->absDirection; 243 251 } 244 252 … … 255 263 { 256 264 this->bAbsDirChanged = true; 257 this->absDirection = *absDir;265 *this->absDirection = *absDir; 258 266 } 259 267 … … 410 418 void PNode::update () 411 419 { 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); 413 421 // printf("%s", this->objectName); 414 422 if(this->mode & PNODE_MOVEMENT ) … … 417 425 { 418 426 /* 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 (); 420 428 } 421 429 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) … … 424 432 if( this->parent == NULL) 425 433 { 426 this->absCoordinate =this->relCoordinate;434 *this->absCoordinate = *this->relCoordinate; 427 435 } 428 436 else 429 this->absCoordinate = parent->getAbsCoor() +this->relCoordinate; /* update the current absCoordinate */437 *this->absCoordinate = parent->getAbsCoor() + *this->relCoordinate; /* update the current absCoordinate */ 430 438 } 431 439 } … … 436 444 { 437 445 /* 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(); 439 447 } 440 448 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 441 449 { 442 450 /* update the current absDirection - remember * means rotation around sth.*/ 443 this->absDirection = parent->getAbsDir() *this->relDirection;451 *this->absDirection = parent->getAbsDir() * *this->relDirection; 444 452 } 445 453 } … … 450 458 { 451 459 /* 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 (); 453 461 } 454 462 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) … … 456 464 /*this is bad style... must be deleted later - just for testing*/ 457 465 if( this->parent == NULL) 458 this->absCoordinate =this->relCoordinate;466 *this->absCoordinate = *this->relCoordinate; 459 467 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 */ 461 469 } 462 470 } … … 505 513 { 506 514 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); 510 518 } 511 519 -
orxonox/trunk/src/lib/coord/p_node.h
r3565 r3607 23 23 24 24 #include "base_object.h" 25 #include "vector.h" 25 26 26 27 // FORWARD DEFINITION \\ … … 28 29 class Quaternion; 29 30 class Vector; 31 template<class T> class tList; 30 32 31 33 //! enumeration for the different translation-binding-types … … 102 104 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked 103 105 104 Vector relCoordinate; //!< coordinates relative to the parent105 Vector absCoordinate; //!< absolute coordinates in the world ( from (0,0,0) )106 Quaternion relDirection; //!< direction relative to the parent107 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) ) 108 110 109 111 int mode; //!< the mode of the binding
Note: See TracChangeset
for help on using the changeset viewer.