55 #ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH 56 #define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH 61 #include <OpenMesh/Tools/VDPM/VHierarchy.hh> 85 unsigned char *buffer_;
96 unsigned char n_shift_;
98 unsigned char flag8(
unsigned char n_shift)
const 99 {
return 0x80 >> n_shift; }
103 assert(_node_handle.
idx() >= 0);
104 return 0x80 >> (
unsigned int) (_node_handle.
idx() % 8);
108 assert(_node_handle.
idx() >= 0);
109 return _node_handle.
idx() / 8;
112 {
return byte_idx(_node_handle) - buffer_min_; }
115 {
return (_node_handle.
idx()/8 < window_min_) ?
true :
false; }
118 {
return (_node_handle.
idx()/8 < window_max_) ?
false :
true; }
121 {
return (_node_handle.
idx()/8 < buffer_min_) ?
true :
false; }
124 {
return (_node_handle.
idx()/8 < int(buffer_max_) ) ?
false :
true; }
133 void set_vertex_hierarchy(
VHierarchy &_vhierarchy)
134 { vhierarchy_ = &_vhierarchy; }
138 int new_window_min = window_min_;
139 for (current_pos_=window_min_-buffer_min_;
140 current_pos_ < window_size(); ++current_pos_)
142 if (buffer_[current_pos_] == 0)
147 while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
152 window_min_ = new_window_min;
164 while (current_pos_ < window_max_-buffer_min_)
166 if (buffer_[current_pos_] != 0)
168 while (n_shift_ != 8)
170 if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
179 bool end() {
return !(current_pos_ < window_max_-buffer_min_); }
181 int window_size()
const {
return window_max_ - window_min_; }
182 size_t buffer_size()
const {
return buffer_max_ - buffer_min_; }
191 update_buffer(_node_handle);
192 buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
193 window_min_ = std::min(window_min_, byte_idx(_node_handle));
194 window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
200 if (is_active(_node_handle) !=
true)
return;
201 buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
207 if (before_window(_node_handle) ==
true ||
208 after_window(_node_handle) ==
true)
210 return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
222 #endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Handle for vertex hierarchy nodes.
Definition: VHierarchyNode.hh:82
int idx() const
Get the underlying index of this handle.
Definition: Handles.hh:74
std::vector< VHierarchyNodeHandle > VHierarchyNodeHandleContainer
Container for vertex hierarchy node handles.
Definition: VHierarchyNode.hh:188
Keeps the vertex hierarchy build during analyzing a progressive mesh.
Definition: VHierarchy.hh:78
Definition: VHierarchyWindow.hh:77