OMToolkit 1.0 The polygonal mesh processing tool.

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMTriBSPTree.h
Go to the documentation of this file.
1 //==============================================================================
17 #ifndef OM_BSP_TREE_H
18 #define OM_BSP_TREE_H
19
20 #include <OMToolkit\OMTriBSPTreeAABB.h>
21 #include <OMToolkit\OMTriBSPTreeTriangle.h>
22 #include <OMToolkit\OMTriBSPTreeRay.h>
23 #include <vector>
24 #include <algorithm>
25
26 //#define USE_MULTIPLE_IN_ONE
27
28 namespace OMToolkit
29 {
33 class OMTriBSPTree
34 {
35 public:
39 typedef OMToolkit::Types::ModuleMeshd MeshT;
40
44 typedef MeshT::Point PointT;
45
49 typedef MeshT::FaceHandle FaceHT;
50
54 typedef MeshT::VertexHandle VertexHT;
55
59 typedef PointT::value_type ScalarT;
60
66 OMTriBSPTree(MeshT *mesh);
67
74 void getPassingFace(PointT& origin, PointT &vector, FaceHT &face);
75
82 void getAllPassingFaces(PointT& origin, PointT &vector, std::vector<FaceHT> &faces);
83
84 public:
88 TreeElement *m_root;
89
94 void ConstructTree();
95
99 static bool sortXFunc (TriCenter const &first, TriCenter const &second);
100
104 static bool sortYFunc (TriCenter const &first, TriCenter const &second);
105
109 static bool sortZFunc (TriCenter const &first, TriCenter const &second);
113 static bool sortIndexFunc (TriCenter const &first, TriCenter const &second);
114
115
116 // static mesh variable (due to static sorting)
117 MeshT *m_mesh;
118 std::vector<TriCenter> m_sorted;
119 };
120
121
125 class StackElement
126 {
127 public:
136 StackElement(int low, int high, int sort, OMTriBSPTree::ScalarT div, TreeElement *p, int id)
137 {
138 lower = low;
139 higher = high;
140 sorted = sort;
141 parent = p;
142 _id = id;
143 }
144
148 int _id;
149 int lower;
150
154 int higher;
155
159 int sorted;
160
164 TreeElement *parent;
165 };
166 } // namespace OMToolkit
167
168 #endif