59 #ifndef TRIANGLEBSPCORET_HH 60 #define TRIANGLEBSPCORET_HH 67 #include <ACG/Geometry/Types/PlaneT.hh> 68 #include <OpenMesh/Core/Geometry/VectorT.hh> 70 #include "TriangleBSPT.hh" 76 template <
class BSPTraits>
81 typedef BSPTraits Traits;
82 typedef typename BSPTraits::Point Point;
83 typedef typename BSPTraits::Handle Handle;
84 typedef typename BSPTraits::Node Node;
85 typedef typename Point::value_type Scalar;
87 typedef std::vector<Handle> Handles;
88 typedef typename Handles::iterator HandleIter;
96 TriangleBSPCoreT(
const BSPTraits& _traits) : traits_(_traits), root_(0), nodes(0), n_triangles(0) {}
105 void reserve(
size_t _n) { handles_.reserve(_n); }
107 void push_back(Handle _h) { handles_.push_back(_h); ++n_triangles; }
112 bool empty() {
return n_triangles == 0; }
117 size_t size() {
return n_triangles; }
124 void build(
unsigned int _max_handles,
unsigned int _max_depth);
131 template <
typename MeshT>
134 root_->visualizeTree(_object, _max_depth-1);
135 _object->update_normals();
150 void _build(Node* _node,
151 unsigned int _max_handles,
152 unsigned int _depth);
163 int nodes, n_triangles;
169 #if defined(OM_INCLUDE_TEMPLATES) && !defined(TRIANGLEBSPCORET_C) 170 # define TRIANGLEBSPCORET_TEMPLATES 171 # include "TriangleBSPCoreT.cc" 174 #endif // TRIANGLEBSPCORET_HH defined
void reserve(size_t _n)
Reserve memory for _n entries.
TriangleBSPCoreT(const BSPTraits &_traits)
void push_back(Handle _h)
Add a handle to the BSP.
void visualizeTree(MeshT *_object, int _max_depth)
Create a PolyMesh object that visualizes the bounding boxes of the BSP tree.
void build(unsigned int _max_handles, unsigned int _max_depth)
~TriangleBSPCoreT()
Destructor.