39#ifndef PCL_OCTREE_ITERATOR_HPP_
40#define PCL_OCTREE_ITERATOR_HPP_
42#include <pcl/console/print.h>
47template <
typename OctreeT>
56template <
typename OctreeT>
66template <
typename OctreeT>
85 stack_.push_back(stack_entry);
92template <
typename OctreeT>
99 unsigned char current_depth =
stack_.back().depth_;
102 while (
stack_.size() && (
stack_.back().depth_ >= current_depth))
115template <
typename OctreeT>
135 for (std::int8_t i = 7; i >= 0; --i) {
136 const unsigned char child_idx = (
unsigned char)i;
139 if (this->
octree_->branchHasChild(*current_branch, child_idx)) {
144 this->
octree_->getBranchChildPtr(*current_branch, child_idx);
146 stack_.push_back(stack_entry);
165template <
typename OctreeT>
176template <
typename OctreeT>
188template <
typename OctreeT>
204 FIFO_.push_back(FIFO_entry);
211template <
typename OctreeT>
229 for (
unsigned char child_idx = 0; child_idx < 8; ++child_idx) {
232 if (this->
octree_->branchHasChild(*current_branch, child_idx)) {
235 current_key.
pushBranch(
static_cast<unsigned char>(child_idx));
238 this->
octree_->getBranchChildPtr(*current_branch, child_idx);
240 FIFO_.push_back(FIFO_entry);
259template <
typename OctreeT>
265template <
typename OctreeT>
271 this->
reset(fixed_depth_arg);
275template <
typename OctreeT>
292 PCL_WARN(
"[pcl::octree::FixedDepthIterator] The requested fixed depth was bigger "
293 "than the octree's depth.\n");
294 PCL_WARN(
"[pcl::octree::FixedDepthIterator] fixed_depth = %d (instead of %d)\n",
315template <
typename OctreeT>
324template <
typename OctreeT>
326 OctreeT* octree_arg,
uindex_t max_depth_arg)
333template <
typename OctreeT>
338 const std::deque<IteratorState>& fifo)
343template <
typename OctreeT>
352template <
typename OctreeT>
365template <
typename OctreeT>
OctreeBreadthFirstIterator & operator++()
Preincrement operator.
void reset()
Reset the iterator to the root node of the octree.
OctreeBreadthFirstIterator(uindex_t max_depth_arg=0)
Empty constructor.
std::deque< IteratorState > FIFO_
FIFO list.
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
std::vector< IteratorState > stack_
Stack structure.
void skipChildVoxels()
Skip all child voxels of current node and return to parent node.
OctreeDepthFirstIterator & operator++()
Preincrement operator.
virtual void reset()
Reset the iterator to the root node of the octree.
OctreeDepthFirstIterator(uindex_t max_depth_arg=0)
Empty constructor.
void reset()
Reset the iterator to the first node at the current depth.
OctreeFixedDepthIterator()
Empty constructor.
uindex_t fixed_depth_
Given level of the node to be iterated.
OctreeT * octree_
Reference to octree class.
uindex_t max_octree_depth_
Maximum octree depth.
uindex_t getCurrentOctreeDepth() const
Get the current depth level of octree.
OctreeIteratorBase()
Empty constructor.
IteratorState * current_state_
Pointer to current iterator state.
void reset()
Reset iterator.
void popBranch()
pop child node from octree key
void pushBranch(unsigned char childIndex)
push a child node to the octree key
Octree leaf node iterator class.
OctreeLeafNodeBreadthFirstIterator(uindex_t max_depth_arg=0)
Empty constructor.
void reset()
Reset the iterator to the first leaf in the breadth first way.
OctreeLeafNodeBreadthFirstIterator & operator++()
Preincrement operator.
virtual node_type_t getNodeType() const =0
Pure virtual method for retrieving the type of octree node (branch or leaf)
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.