39 #ifndef PCL_OCTREE_ITERATOR_HPP_ 40 #define PCL_OCTREE_ITERATOR_HPP_ 47 template<
typename OctreeT>
56 template<
typename OctreeT>
65 template<
typename OctreeT>
71 template<
typename OctreeT>
79 stack_.reserve (this->max_octree_depth_);
86 stack_entry.
node_ = this->octree_->getRootNode ();
90 stack_.push_back(stack_entry);
92 this->current_state_ = &stack_.back();
98 template<
typename OctreeT>
105 unsigned char current_depth = stack_.back ().depth_;
108 while (stack_.size () && (stack_.back ().depth_ >= current_depth))
113 this->current_state_ = &stack_.back();
116 this->current_state_ = 0;
123 template<
typename OctreeT>
137 if ( (this->max_octree_depth_>=stack_entry.
depth_) &&
140 unsigned char child_idx;
147 for (child_idx = 0; child_idx < 8; ++child_idx)
152 if (this->octree_->branchHasChild(*current_branch, child_idx))
157 stack_entry.
node_ = this->octree_->getBranchChildPtr(*current_branch, child_idx);
159 stack_.push_back(stack_entry);
168 this->current_state_ = &stack_.back();
171 this->current_state_ = 0;
179 template<
typename OctreeT>
190 template<
typename OctreeT>
201 template<
typename OctreeT>
207 template<
typename OctreeT>
219 FIFO_entry.
node_ = this->octree_->getRootNode ();
223 FIFO_.push_back(FIFO_entry);
225 this->current_state_ = &FIFO_.front();
230 template<
typename OctreeT>
244 if ( (this->max_octree_depth_>=FIFO_entry.
depth_) &&
247 unsigned char child_idx;
254 for (child_idx = 0; child_idx < 8 ; ++child_idx)
258 if (this->octree_->branchHasChild(*current_branch, child_idx))
261 current_key.
pushBranch (static_cast<unsigned char> (child_idx));
263 FIFO_entry.
node_ = this->octree_->getBranchChildPtr(*current_branch, child_idx);
265 FIFO_.push_back(FIFO_entry);
274 this->current_state_ = &FIFO_.front();
277 this->current_state_ = 0;
void reset()
Reset iterator.
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
OctreeT::BranchNode BranchNode
void popBranch()
pop child node from octree key
void reset()
Reset the iterator to the root node of the octree.
virtual void reset()
Reset the iterator to the root node of the octree.
OctreeDepthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
void skipChildVoxels()
Skip all child voxels of current node and return to parent node.
virtual ~OctreeBreadthFirstIterator()
Empty deconstructor.
OctreeBreadthFirstIterator & operator++()
Preincrement operator.
OctreeDepthFirstIterator & operator++()
Preincrement operator.
Abstract octree iterator class
void pushBranch(unsigned char childIndex)
push a child node to the octree key
virtual ~OctreeDepthFirstIterator()
Empty deconstructor.
OctreeBreadthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.