Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/p_node.h @ 3248

Last change on this file since 3248 was 3248, checked in by patrick, 19 years ago

orxonox/branches/parenting: defined all function/variables now will have to implement them

File size: 2.2 KB
RevLine 
[3246]1/*!
2    \file p_node.h
3    \brief Definition of a parenting node
4
5    parenting is how coordinates are handled in orxonox, meaning, that all coordinates
6    are representet relative to another parent node. this nodes build a parenting
7    tree of one-sided references (from up to down referenced).
8    Every node manages itself a list of childrens (of whos it is parent - easy...)
9
10    absCoordinate, absDirection have to be recalculated as soon as there was a change in
11    place or ortientation. this is only the case if
12    o bDirChanged is true (so changed) AND timeStamp != now
13    o bCoorChanged is true (so moved) AND timeStamp != now
14    this conditions make it cheaper to recalculate the tree (reduces redundant work).
15
[3247]16    remember: if you have to change the coordinates or the directions, use the functions
17    that are defined to execute this operation - otherwhise there will be big problems...
[3246]18*/
19
20
21#ifndef _P_NODE_H
22#define _P_NODE_H
23
24#include "stdincl.h"
25
[3248]26class PNode; /* forward decleration, so that parentEntry has access to PNode */
[3246]27
[3248]28typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL};
29#define DEFAULT_MODE ALL
30
[3246]31class PNode {
32
33 public:
34  PNode ();
35  ~PNode ();
36
[3248]37  parentingMode mode;
38
[3246]39  Vector getRelCoor ();
40  void setRelCoor (Vector relCoord);
41  Vector getAbsCoor ();
42  void setAbsCoor (Vector absCoord);
[3248]43  void shiftCoor (Vector shift);
[3246]44
45  Quaternion getRelDir ();
46  void setRelDir (Quaternion relDir);
47  Quaternion getAbsDir ();
[3247]48  void setAbsDir (Quaternion absDir);
[3248]49  void shiftDir (Quaternion shift);
[3246]50
51  void addChild (PNode* pNode);
[3248]52  void addChild (PNode* pNode, parentingMode mode);
[3246]53  void removeChild (PNode* pNode);
[3247]54  void setParent (PNode* parent);
[3248]55  void update ();
[3246]56
57 private:
58  long timeStamp; //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated
59  bool bCoorChanged;
60  bool bDirChanged;
61
62  Vector relCoordinate;  //! coordinates relative to the parent
63  Vector absCoordinate; //! absolute coordinates in the world ( from (0,0,0) )
64  Quaternion relDirection; //! direction relative to the parent
65  Quaternion absDirection; //! absolute direvtion in the world ( from (0,0,1) )
66
[3247]67  PNode* parent;
[3246]68  tList<PNode>* children; //! list of the children
69
70};
71
72#endif /* _P_NODE_H */
Note: See TracBrowser for help on using the repository browser.