/*! \file p_node.h \brief Definition of a parenting node parenting is how coordinates are handled in orxonox, meaning, that all coordinates are representet relative to another parent node. this nodes build a parenting tree of one-sided references (from up to down referenced). Every node manages itself a list of childrens (of whos it is parent - easy...) absCoordinate, absDirection have to be recalculated as soon as there was a change in place or ortientation. this is only the case if o bDirChanged is true (so changed) AND timeStamp != now o bCoorChanged is true (so moved) AND timeStamp != now this conditions make it cheaper to recalculate the tree (reduces redundant work). remember: if you have to change the coordinates, because the object (point) did move, don't forget to reset both relCoor and absCoor (offset is the same) */ #ifndef _P_NODE_H #define _P_NODE_H #include "stdincl.h" class PNode { public: PNode (); ~PNode (); Vector getRelCoor (); void setRelCoor (Vector relCoord); Vector getAbsCoor (); void setAbsCoor (Vector absCoord); Quaternion getRelDir (); void setRelDir (Quaternion relDir); Quaternion getAbsDir (); void setAbsCoor (Quaternion absDir); void addChild (PNode* pNode); void removeChild (PNode* pNode); private: long timeStamp; //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated bool bCoorChanged; bool bDirChanged; Vector relCoordinate; //! coordinates relative to the parent Vector absCoordinate; //! absolute coordinates in the world ( from (0,0,0) ) Quaternion relDirection; //! direction relative to the parent Quaternion absDirection; //! absolute direvtion in the world ( from (0,0,1) ) tList* children; //! list of the children }; #endif /* _P_NODE_H */