39 #ifndef PCL_OCTREE_ITERATOR_HPP_
40 #define PCL_OCTREE_ITERATOR_HPP_
45 #include <pcl/common/common.h>
52 template<
typename OctreeT>
61 template<
typename OctreeT>
70 template<
typename OctreeT>
76 template<
typename OctreeT>
84 stack_.reserve (this->max_octree_depth_);
91 stack_entry.
node_ = this->octree_->getRootNode ();
95 stack_.push_back(stack_entry);
97 this->current_state_ = &stack_.back();
103 template<
typename OctreeT>
110 unsigned char current_depth = stack_.back ().depth_;
113 while (stack_.size () && (stack_.back ().depth_ >= current_depth))
118 this->current_state_ = &stack_.back();
121 this->current_state_ = 0;
128 template<
typename OctreeT>
142 if ( (this->max_octree_depth_>=stack_entry.
depth_) &&
145 unsigned char child_idx;
152 for (child_idx = 0; child_idx < 8; ++child_idx)
157 if (this->octree_->branchHasChild(*current_branch, child_idx))
162 stack_entry.
node_ = this->octree_->getBranchChildPtr(*current_branch, child_idx);
164 stack_.push_back(stack_entry);
173 this->current_state_ = &stack_.back();
176 this->current_state_ = 0;
184 template<
typename OctreeT>
195 template<
typename OctreeT>
206 template<
typename OctreeT>
212 template<
typename OctreeT>
224 FIFO_entry.
node_ = this->octree_->getRootNode ();
228 FIFO_.push_back(FIFO_entry);
230 this->current_state_ = &FIFO_.front();
235 template<
typename OctreeT>
249 if ( (this->max_octree_depth_>=FIFO_entry.
depth_) &&
252 unsigned char child_idx;
259 for (child_idx = 0; child_idx < 8 ; ++child_idx)
263 if (this->octree_->branchHasChild(*current_branch, child_idx))
266 current_key.
pushBranch (static_cast<unsigned char> (child_idx));
268 FIFO_entry.
node_ = this->octree_->getBranchChildPtr(*current_branch, child_idx);
270 FIFO_.push_back(FIFO_entry);
279 this->current_state_ = &FIFO_.front();
282 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.