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>
74 stack_.reserve(this->max_octree_depth_);
87 this->current_state_ = &stack_.back();
92template <
typename OctreeT>
102 while (stack_.size() && (stack_.back().depth_ >=
current_depth))
106 this->current_state_ = &stack_.back();
109 this->current_state_ = 0;
115template <
typename OctreeT>
127 if ((this->max_octree_depth_ >=
stack_entry.depth_) &&
135 for (std::int8_t i = 7; i >= 0; --i) {
154 this->current_state_ = &stack_.back();
157 this->current_state_ = 0;
165template <
typename OctreeT>
176template <
typename OctreeT>
188template <
typename OctreeT>
200 FIFO_entry.node_ = this->octree_->getRootNode();
206 this->current_state_ = &FIFO_.front();
211template <
typename OctreeT>
223 if ((this->max_octree_depth_ >=
FIFO_entry.depth_) &&
248 this->current_state_ = &FIFO_.front();
251 this->current_state_ = 0;
259template <
typename OctreeT>
265template <
typename OctreeT>
271 this->
reset(fixed_depth_arg);
275template <
typename OctreeT>
282 if (!this->octree_) {
291 if (this->octree_->getTreeDepth() < fixed_depth_) {
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",
295 this->octree_->getTreeDepth(),
303 this->max_octree_depth_ = std::min(fixed_depth_, this->octree_->getTreeDepth());
307 this->current_state_ = &FIFO_.front();
310 while (this->current_state_ && (this->getCurrentOctreeDepth() != fixed_depth_))
315template <
typename OctreeT>
324template <
typename OctreeT>
333template <
typename OctreeT>
338 const std::deque<IteratorState>&
fifo)
343template <
typename OctreeT>
352template <
typename OctreeT>
358 }
while ((this->current_state_) &&
359 (this->current_state_->node_->getNodeType() !=
LEAF_NODE));
365template <
typename OctreeT>
Iterator class for point clouds with or without given indices.
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.
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
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.
Abstract octree iterator class
void reset()
Reset iterator.
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.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.