Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/parenting: parenting now debugged, ready to be integrated into the framework.

File size: 2.5 KB
Line 
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
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...
18*/
19
20
21#ifndef _P_NODE_H
22#define _P_NODE_H
23
24#include "stdincl.h"
25
26class PNode; /* forward decleration, so that parentEntry has access to PNode */
27
28typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL};
29#define DEFAULT_MODE ALL
30
31class PNode {
32
33 public:
34  PNode ();
35  PNode (Vector* absCoordinate, PNode* pNode);
36  ~PNode ();
37
38  PNode* parent; //! a pointer to the parent node
39  tList<PNode>* children; //! list of the children
40
41  parentingMode mode;
42
43  Vector getRelCoor ();
44  void setRelCoor (Vector* relCoord);
45  Vector getAbsCoor ();
46  void setAbsCoor (Vector* absCoord);
47  void shiftCoor (Vector* shift);
48
49  Quaternion getRelDir ();
50  void setRelDir (Quaternion* relDir);
51  Quaternion getAbsDir ();
52  void setAbsDir (Quaternion* absDir);
53  void shiftDir (Quaternion* shift);
54
55  void addChild (PNode* pNode);
56  void addChild (PNode* pNode, parentingMode mode);
57  void removeChild (PNode* pNode);
58  void setParent (PNode* parent);
59  void parentCoorChanged ();
60  void parentDirChanged ();
61  void setMode (parentingMode mode);
62  virtual void update (long timeStamp);
63
64  void debug ();
65
66 private:
67  long timeStamp;   //! this the timeStamp of when the abs{Coordinat, Direction} has been calculated
68  bool bAbsCoorChanged;
69  bool bRelCoorChanged;
70  bool bRelDirChanged;
71  bool bAbsDirChanged;
72
73  Vector relCoordinate;  //! coordinates relative to the parent
74  Vector absCoordinate; //! absolute coordinates in the world ( from (0,0,0) )
75  Quaternion relDirection; //! direction relative to the parent
76  Quaternion absDirection; //! absolute direvtion in the world ( from (0,0,1) )
77
78};
79
80#endif /* _P_NODE_H */
Note: See TracBrowser for help on using the repository browser.