gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
SceneGraphNode.h
Go to the documentation of this file.
1 #ifndef __SceneGraphNode_h
2 #define __SceneGraphNode_h
3 
4 
5 #include <string>
6 #include <vector>
7 
8 #ifndef __Types_h
9 #include "gVirtualXRay/Types.h"
10 #endif
11 
12 #ifndef __PolygonMesh_h
14 #endif
15 
16 #ifndef __PhotonCrossSection_h
18 #endif
19 
20 
21 //******************************************************************************
22 // namespace
23 //******************************************************************************
24 namespace gVirtualXRay {
25 
26 
27 class SceneGraphBinder;
28 
29 
31 {
32 public:
33  SceneGraphNode(const std::string& aLabel = "",
34  SceneGraphNode* apParent = 0);
35 
36 
37  SceneGraphNode(const SceneGraphNode& aNode);
38 
39 
40  SceneGraphNode(const std::string& aLabel,
41  const PolygonMesh& aPolygonMesh,
42  const VEC3& aPosition,
43  SceneGraphNode* apParent);
44 
45 
46  SceneGraphNode(const std::string& aLabel,
47  PolygonMesh* apPolygonMesh,
48  const VEC3& aPosition,
49  SceneGraphNode* apParent);
50 
51 
53 
54 
56 
57  void release();
58  void clear();
59 
60  void display();
61  void displayWireFrame();
62 
63  const SceneGraphNode* getParent() const;
64 
65 
66  unsigned int getNumberOfChildren() const;
67 
68 
69  gVirtualXRay::SceneGraphNode& getChild(unsigned int i);
70 
71 
72  const gVirtualXRay::SceneGraphNode& getChild(unsigned int i) const;
73 
74 
75  gVirtualXRay::SceneGraphNode& getChild(const std::string& aLabel);
76 
77 
78  const gVirtualXRay::SceneGraphNode& getChild(const std::string& aLabel) const;
79 
80 
81  const std::string& getLabel() const;
82 
83 
84  void setGeometry(const PolygonMesh& aPolygonMesh);
85 
86 
87  void setGeometry(PolygonMesh* apPolygonMesh);
88 
89 
91 
92 
93  const PolygonMesh& getPolygonMesh() const;
94 
95 
97 
98 
100 
101 
102  void setLocalTransformation(const MATRIX4& aMatrix);
103 
104 
105  void applyLocalTransformation(const MATRIX4& aMatrix);
106 
107 
108  void addChild(const std::string& aLabel);
109 
110 
111  void addChild(const std::string& aLabel, const PolygonMesh& aPolygonMesh, const VEC3& aPosition = VEC3());
112 
113 
114  void addChild(const std::string& aLabel, PolygonMesh* apPolygonMesh, const VEC3& aPosition = VEC3());
115 
116  // AABB is in local coordinate system
117  // aRayOrigin and aRayDirection are in global coordinate system
118  std::map<RATIONAL_NUMBER, VEC3> rayIntersectAABB(
119  const VEC3& aRayOrigin,
120  const VEC3& aRayDirection);
121 
122 
123  //VEC3 getLocalMinCorner() const;
124  //VEC3 getLocalMaxCorner() const;
125  //VEC3 getWorldMinCorner();
126  //VEC3 getWorldMaxCorner();
129 
132 
134 
135  std::map<RATIONAL_NUMBER, VEC3> rayIntersect(
136  const VEC3& aRayOrigin,
137  const VEC3& aRayDirection,
138  const MATRIX4& aTransformationMatrix);
139 
140 
141  //SceneGraphNode& operator=(const SceneGraphNode& aNode);
142 
143 
144  friend class SceneGraphBinder;
145 
146 
147 protected:
148  void updateWorldMatrix();
149 
150  std::string m_label;
151 
154 
157 
159 
161 
162  std::vector<gVirtualXRay::SceneGraphNode*> m_p_children;
163 
165 };
166 
167 
168 } // namespace gVirtualXRay
169 
170 
171 #endif // __SceneGraphNode_h
Type declarations.
void applyLocalTransformation(const MATRIX4 &aMatrix)
SceneGraphNode & operator=(const SceneGraphNode &aNode)
gVirtualXRay::SceneGraphNode & getChild(unsigned int i)
std::vector< gVirtualXRay::SceneGraphNode * > m_p_children
std::map< RATIONAL_NUMBER, VEC3 > rayIntersect(const VEC3 &aRayOrigin, const VEC3 &aRayDirection, const MATRIX4 &aTransformationMatrix)
SceneGraphNode(const std::string &aLabel="", SceneGraphNode *apParent=0)
PolygonMesh is a class to handle polygon (triangles) meshes.
Definition: PolygonMesh.h:114
const SceneGraphNode * getParent() const
gVirtualXRay::SceneGraphNode * m_p_parent
void addChild(const std::string &aLabel)
Vec3< RATIONAL_NUMBER > VEC3
Type of data used to store 3D vectors.
Definition: Types.h:115
Class to manage photon cross sections of elements, compounds and mixtures.
PhotonCrossSection is a class to manage photon cross sections of elements, compounds and mixtures...
std::map< RATIONAL_NUMBER, VEC3 > rayIntersectAABB(const VEC3 &aRayOrigin, const VEC3 &aRayDirection)
const std::string & getLabel() const
unsigned int getNumberOfChildren() const
PolygonMesh & getPolygonMesh()
void setLocalTransformation(const MATRIX4 &aMatrix)
Class to handle polygon (triangles) meshes.
void setGeometry(const PolygonMesh &aPolygonMesh)
MATRIX4 getLocalTransformationMatrix() const
const PhotonCrossSection & getPhotonCrossSection() const