50 #ifndef OPENMESH_VDPROGMESH_VHIERARCHY_HH
51 #define OPENMESH_VDPROGMESH_VHIERARCHY_HH
57 #include <OpenMesh/Tools/VDPM/VHierarchyNode.hh>
82 unsigned int n_roots_;
83 unsigned char tree_id_bits_;
89 void clear() { nodes_.clear(); n_roots_ = 0; }
90 unsigned char tree_id_bits()
const {
return tree_id_bits_; }
91 unsigned int num_roots()
const {
return n_roots_; }
92 size_t num_nodes()
const {
return nodes_.size(); }
94 VHierarchyNodeIndex generate_node_index(id_t _tree_id, id_t _node_id)
96 return VHierarchyNodeIndex(_tree_id, _node_id, tree_id_bits_);
100 void set_num_roots(
unsigned int _n_roots);
102 VHierarchyNodeHandle root_handle(
unsigned int i)
const
104 return VHierarchyNodeHandle( (
int)i );
108 const VHierarchyNode& node(VHierarchyNodeHandle _vhierarchynode_handle)
const
110 return nodes_[_vhierarchynode_handle.idx()];
114 VHierarchyNode& node(VHierarchyNodeHandle _vhierarchynode_handle)
116 return nodes_[_vhierarchynode_handle.idx()];
119 VHierarchyNodeHandle add_node();
120 VHierarchyNodeHandle add_node(
const VHierarchyNode &_node);
122 void make_children(VHierarchyNodeHandle &_parent_handle);
124 bool is_ancestor(VHierarchyNodeIndex _ancestor_index,
125 VHierarchyNodeIndex _descendent_index);
127 bool is_leaf_node(VHierarchyNodeHandle _node_handle)
128 {
return nodes_[_node_handle.idx()].is_leaf(); }
130 bool is_root_node(VHierarchyNodeHandle _node_handle)
131 {
return nodes_[_node_handle.idx()].is_root(); }
136 return nodes_[_node_handle.idx()].normal();
139 const VHierarchyNodeIndex&
140 node_index(VHierarchyNodeHandle _node_handle)
const
141 {
return nodes_[_node_handle.idx()].node_index(); }
143 VHierarchyNodeIndex& node_index(VHierarchyNodeHandle _node_handle)
144 {
return nodes_[_node_handle.idx()].node_index(); }
146 const VHierarchyNodeIndex&
147 fund_lcut_index(VHierarchyNodeHandle _node_handle)
const
148 {
return nodes_[_node_handle.idx()].fund_lcut_index(); }
150 VHierarchyNodeIndex& fund_lcut_index(VHierarchyNodeHandle _node_handle)
151 {
return nodes_[_node_handle.idx()].fund_lcut_index(); }
153 const VHierarchyNodeIndex&
154 fund_rcut_index(VHierarchyNodeHandle _node_handle)
const
155 {
return nodes_[_node_handle.idx()].fund_rcut_index(); }
157 VHierarchyNodeIndex& fund_rcut_index(VHierarchyNodeHandle _node_handle)
158 {
return nodes_[_node_handle.idx()].fund_rcut_index(); }
160 VertexHandle vertex_handle(VHierarchyNodeHandle _node_handle)
161 {
return nodes_[_node_handle.idx()].vertex_handle(); }
163 VHierarchyNodeHandle parent_handle(VHierarchyNodeHandle _node_handle)
164 {
return nodes_[_node_handle.idx()].parent_handle(); }
166 VHierarchyNodeHandle lchild_handle(VHierarchyNodeHandle _node_handle)
167 {
return nodes_[_node_handle.idx()].lchild_handle(); }
169 VHierarchyNodeHandle rchild_handle(VHierarchyNodeHandle _node_handle)
170 {
return nodes_[_node_handle.idx()].rchild_handle(); }
172 VHierarchyNodeHandle node_handle(VHierarchyNodeIndex _node_index);
176 VHierarchyNodeHandle compute_dependency(VHierarchyNodeIndex index0,
177 VHierarchyNodeIndex index1);
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
std::vector< VHierarchyNode > VHierarchyNodeContainer
Container for vertex hierarchy nodes.
Definition: VHierarchyNode.hh:180
Keeps the vertex hierarchy build during analyzing a progressive mesh.
Definition: VHierarchy.hh:74
unsigned int id_t
Type for tree and node ids.
Definition: VHierarchy.hh:77