49#ifndef TRIANGLEBSPCORET_HH
50#define TRIANGLEBSPCORET_HH
57#include <ACG/Geometry/Types/PlaneT.hh>
58#include <OpenMesh/Core/Geometry/VectorT.hh>
60#include "TriangleBSPT.hh"
66template <
class BSPTraits>
71 typedef BSPTraits Traits;
72 typedef typename BSPTraits::Point Point;
73 typedef typename BSPTraits::Handle Handle;
74 typedef typename BSPTraits::Node Node;
75 typedef typename Point::value_type Scalar;
77 typedef std::vector<Handle> Handles;
78 typedef typename Handles::iterator HandleIter;
86 explicit TriangleBSPCoreT(
const BSPTraits& _traits) : traits_(_traits), root_(0), nodes(0), n_triangles(0) {}
95 void reserve(
size_t _n) { handles_.reserve(_n); }
97 void push_back(Handle _h) { handles_.push_back(_h); ++n_triangles; }
102 bool empty() {
return n_triangles == 0; }
107 size_t size() {
return n_triangles; }
114 void build(
unsigned int _max_handles,
unsigned int _max_depth);
121 template <
typename MeshT>
124 root_->visualizeTree(_object, _max_depth-1);
125 _object->update_normals();
140 void _build(Node* _node,
141 unsigned int _max_handles,
142 unsigned int _depth);
153 int nodes, n_triangles;
159#if defined(OM_INCLUDE_TEMPLATES) && !defined(TRIANGLEBSPCORET_C)
160# define TRIANGLEBSPCORET_TEMPLATES
161# include "TriangleBSPCoreT_impl.hh"
~TriangleBSPCoreT()
Destructor.
TriangleBSPCoreT(const BSPTraits &_traits)
void build(unsigned int _max_handles, unsigned int _max_depth)
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 reserve(size_t _n)
Reserve memory for _n entries.