48 #ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
49 #define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
54 #include <OpenMesh/Tools/VDPM/VHierarchy.hh>
78 unsigned char *buffer_;
89 unsigned char n_shift_;
91 unsigned char flag8(
unsigned char n_shift)
const
92 {
return 0x80 >> n_shift; }
96 assert(_node_handle.
idx() >= 0);
97 return 0x80 >> (
unsigned int) (_node_handle.
idx() % 8);
101 assert(_node_handle.
idx() >= 0);
102 return _node_handle.
idx() / 8;
105 {
return byte_idx(_node_handle) - buffer_min_; }
108 {
return (_node_handle.
idx()/8 < window_min_) ?
true :
false; }
111 {
return (_node_handle.
idx()/8 < window_max_) ?
false :
true; }
114 {
return (_node_handle.
idx()/8 < buffer_min_) ?
true :
false; }
117 {
return (_node_handle.
idx()/8 < int(buffer_max_) ) ?
false :
true; }
126 void set_vertex_hierarchy(
VHierarchy &_vhierarchy)
127 { vhierarchy_ = &_vhierarchy; }
131 int new_window_min = window_min_;
132 for (current_pos_=window_min_-buffer_min_;
133 current_pos_ < window_size(); ++current_pos_)
135 if (buffer_[current_pos_] == 0)
140 while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
145 window_min_ = new_window_min;
157 while (current_pos_ < window_max_-buffer_min_)
159 if (buffer_[current_pos_] != 0)
161 while (n_shift_ != 8)
163 if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
172 bool end() {
return !(current_pos_ < window_max_-buffer_min_); }
174 int window_size()
const {
return window_max_ - window_min_; }
175 size_t buffer_size()
const {
return buffer_max_ - buffer_min_; }
184 update_buffer(_node_handle);
185 buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
186 window_min_ = std::min(window_min_, byte_idx(_node_handle));
187 window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
193 if (is_active(_node_handle) !=
true)
return;
194 buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
200 if (before_window(_node_handle) ==
true ||
201 after_window(_node_handle) ==
true)
203 return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
215 #endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
int idx() const
Get the underlying index of this handle.
Definition: Handles.hh:67
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
Definition: VHierarchyWindow.hh:70
std::vector< VHierarchyNodeHandle > VHierarchyNodeHandleContainer
Container for vertex hierarchy node handles.
Definition: VHierarchyNode.hh:181
Handle for vertex hierarchy nodes.
Definition: VHierarchyNode.hh:75
Keeps the vertex hierarchy build during analyzing a progressive mesh.
Definition: VHierarchy.hh:71