55 #ifndef OPENMESH_VDPROGMESH_VHIERARCHY_HH
56 #define OPENMESH_VDPROGMESH_VHIERARCHY_HH
62 #include <OpenMesh/Tools/VDPM/VHierarchyNode.hh>
87 unsigned int n_roots_;
88 unsigned char tree_id_bits_;
94 void clear() { nodes_.clear(); n_roots_ = 0; }
95 unsigned char tree_id_bits()
const {
return tree_id_bits_; }
96 unsigned int num_roots()
const {
return n_roots_; }
97 size_t num_nodes()
const {
return nodes_.size(); }
99 VHierarchyNodeIndex generate_node_index(id_t _tree_id, id_t _node_id)
101 return VHierarchyNodeIndex(_tree_id, _node_id, tree_id_bits_);
105 void set_num_roots(
unsigned int _n_roots);
107 VHierarchyNodeHandle root_handle(
unsigned int i)
const
109 return VHierarchyNodeHandle( (
int)i );
113 const VHierarchyNode& node(VHierarchyNodeHandle _vhierarchynode_handle)
const
115 return nodes_[_vhierarchynode_handle.idx()];
119 VHierarchyNode& node(VHierarchyNodeHandle _vhierarchynode_handle)
121 return nodes_[_vhierarchynode_handle.idx()];
124 VHierarchyNodeHandle add_node();
125 VHierarchyNodeHandle add_node(
const VHierarchyNode &_node);
127 void make_children(VHierarchyNodeHandle &_parent_handle);
129 bool is_ancestor(VHierarchyNodeIndex _ancestor_index,
130 VHierarchyNodeIndex _descendent_index);
132 bool is_leaf_node(VHierarchyNodeHandle _node_handle)
133 {
return nodes_[_node_handle.idx()].is_leaf(); }
135 bool is_root_node(VHierarchyNodeHandle _node_handle)
136 {
return nodes_[_node_handle.idx()].is_root(); }
141 return nodes_[_node_handle.idx()].normal();
144 const VHierarchyNodeIndex&
145 node_index(VHierarchyNodeHandle _node_handle)
const
146 {
return nodes_[_node_handle.idx()].node_index(); }
148 VHierarchyNodeIndex& node_index(VHierarchyNodeHandle _node_handle)
149 {
return nodes_[_node_handle.idx()].node_index(); }
151 const VHierarchyNodeIndex&
152 fund_lcut_index(VHierarchyNodeHandle _node_handle)
const
153 {
return nodes_[_node_handle.idx()].fund_lcut_index(); }
155 VHierarchyNodeIndex& fund_lcut_index(VHierarchyNodeHandle _node_handle)
156 {
return nodes_[_node_handle.idx()].fund_lcut_index(); }
158 const VHierarchyNodeIndex&
159 fund_rcut_index(VHierarchyNodeHandle _node_handle)
const
160 {
return nodes_[_node_handle.idx()].fund_rcut_index(); }
162 VHierarchyNodeIndex& fund_rcut_index(VHierarchyNodeHandle _node_handle)
163 {
return nodes_[_node_handle.idx()].fund_rcut_index(); }
165 VertexHandle vertex_handle(VHierarchyNodeHandle _node_handle)
166 {
return nodes_[_node_handle.idx()].vertex_handle(); }
168 VHierarchyNodeHandle parent_handle(VHierarchyNodeHandle _node_handle)
169 {
return nodes_[_node_handle.idx()].parent_handle(); }
171 VHierarchyNodeHandle lchild_handle(VHierarchyNodeHandle _node_handle)
172 {
return nodes_[_node_handle.idx()].lchild_handle(); }
174 VHierarchyNodeHandle rchild_handle(VHierarchyNodeHandle _node_handle)
175 {
return nodes_[_node_handle.idx()].rchild_handle(); }
177 VHierarchyNodeHandle node_handle(VHierarchyNodeIndex _node_index);
181 VHierarchyNodeHandle compute_dependency(VHierarchyNodeIndex index0,
182 VHierarchyNodeIndex index1);
192 #endif // OPENMESH_VDPROGMESH_VHIERARCHY_HH defined
unsigned int id_t
Type for tree and node ids.
std::vector< VHierarchyNode > VHierarchyNodeContainer
Container for vertex hierarchy nodes.