OMToolkit  1.0
The polygonal mesh processing tool.
 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 
23 #include <vector>
24 #include <algorithm>
25 
26 //#define USE_MULTIPLE_IN_ONE
27 
28 namespace OMToolkit
29 {
34  {
35  public:
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:
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)
118  std::vector<TriCenter> m_sorted;
119  };
120 
121 
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 
165  };
166 } // namespace OMToolkit
167 
168 #endif