Point Cloud Library (PCL)  1.10.1-dev
octree_iterator.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  * Copyright (c) 2017-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of Willow Garage, Inc. nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id$
38  */
39 
40 #pragma once
41 
42 #include <cstddef>
43 #include <deque>
44 #include <vector>
45 
46 #include <pcl/octree/octree_key.h>
47 #include <pcl/octree/octree_nodes.h>
48 
49 #include <iterator>
50 
51 // Ignore warnings in the above headers
52 #ifdef __GNUC__
53 #pragma GCC system_header
54 #endif
55 
56 namespace pcl {
57 namespace octree {
58 
59 // Octree iterator state pushed on stack/list
60 struct IteratorState {
63  unsigned int depth_;
64 };
65 
66 /** \brief @b Abstract octree iterator class
67  * \note Octree iterator base class
68  * \ingroup octree
69  * \author Julius Kammerl (julius@kammerl.de)
70  */
71 template <typename OctreeT>
72 class OctreeIteratorBase : public std::iterator<std::forward_iterator_tag,
73  const OctreeNode,
74  void,
75  const OctreeNode*,
76  const OctreeNode&> {
77 public:
78  using LeafNode = typename OctreeT::LeafNode;
79  using BranchNode = typename OctreeT::BranchNode;
80 
81  using LeafContainer = typename OctreeT::LeafContainer;
82  using BranchContainer = typename OctreeT::BranchContainer;
83 
84  /** \brief Empty constructor.
85  */
86  explicit OctreeIteratorBase(unsigned int max_depth_arg = 0)
87  : octree_(0), current_state_(0), max_octree_depth_(max_depth_arg)
88  {
89  this->reset();
90  }
91 
92  /** \brief Constructor.
93  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
94  * root node.
95  * \param[in] max_depth_arg Depth limitation during traversal
96  */
97  explicit OctreeIteratorBase(OctreeT* octree_arg, unsigned int max_depth_arg = 0)
98  : octree_(octree_arg), current_state_(0), max_octree_depth_(max_depth_arg)
99  {
100  this->reset();
101  }
102 
103  /** \brief Constructor.
104  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
105  * root node.
106  * \param[in] max_depth_arg Depth limitation during traversal
107  * \param[in] current_state A pointer to the current iterator state
108  *
109  * \warning For advanced users only.
110  */
111  explicit OctreeIteratorBase(OctreeT* octree_arg,
112  unsigned int max_depth_arg,
113  IteratorState* current_state)
114  : octree_(octree_arg), current_state_(current_state), max_octree_depth_(max_depth_arg)
115  {}
116 
117  /** \brief Empty deconstructor. */
118  virtual ~OctreeIteratorBase() {}
119 
120  /** \brief Equal comparison operator
121  * \param[in] other OctreeIteratorBase to compare with
122  */
123  bool
124  operator==(const OctreeIteratorBase& other) const
125  {
126  if (this == &other) // same object
127  return true;
128  if (octree_ != other.octree_) // refer to different octrees
129  return false;
130  if (!current_state_ && !other.current_state_) // both are end iterators
131  return true;
132  if (max_octree_depth_ == other.max_octree_depth_ && current_state_ &&
133  other.current_state_ && // null dereference protection
134  current_state_->key_ == other.current_state_->key_)
135  return true;
136  return false;
137  }
138 
139  /** \brief Inequal comparison operator
140  * \param[in] other OctreeIteratorBase to compare with
141  */
142  bool
143  operator!=(const OctreeIteratorBase& other) const
144  {
145  return !operator==(other);
146  }
147 
148  /** \brief Reset iterator */
149  inline void
151  {
152  current_state_ = 0;
153  if (octree_ && (!max_octree_depth_)) {
154  max_octree_depth_ = octree_->getTreeDepth();
155  }
156  }
157 
158  /** \brief Get octree key for the current iterator octree node
159  * \return octree key of current node
160  */
161  inline const OctreeKey&
163  {
164  assert(octree_ != 0);
165  assert(current_state_ != 0);
166 
167  return (current_state_->key_);
168  }
169 
170  /** \brief Get the current depth level of octree
171  * \return depth level
172  */
173  inline unsigned int
175  {
176  assert(octree_ != 0);
177  assert(current_state_ != 0);
178 
179  return (current_state_->depth_);
180  }
181 
182  /** \brief Get the current octree node
183  * \return pointer to current octree node
184  */
185  inline OctreeNode*
187  {
188  assert(octree_ != 0);
189  assert(current_state_ != 0);
190 
191  return (current_state_->node_);
192  }
193 
194  /** \brief check if current node is a branch node
195  * \return true if current node is a branch node, false otherwise
196  */
197  inline bool
198  isBranchNode() const
199  {
200  assert(octree_ != 0);
201  assert(current_state_ != 0);
202 
203  return (current_state_->node_->getNodeType() == BRANCH_NODE);
204  }
205 
206  /** \brief check if current node is a branch node
207  * \return true if current node is a branch node, false otherwise
208  */
209  inline bool
210  isLeafNode() const
211  {
212  assert(octree_ != 0);
213  assert(current_state_ != 0);
214 
215  return (current_state_->node_->getNodeType() == LEAF_NODE);
216  }
217 
218  /** \brief *operator.
219  * \return pointer to the current octree node
220  */
221  inline OctreeNode* operator*() const
222  { // return designated object
223  if (octree_ && current_state_) {
224  return (current_state_->node_);
225  }
226  else {
227  return 0;
228  }
229  }
230 
231  /** \brief Get bit pattern of children configuration of current node
232  * \return bit pattern (byte) describing the existence of 8 children of the current
233  * node
234  */
235  inline char
237  {
238  char ret = 0;
239 
240  assert(octree_ != 0);
241  assert(current_state_ != 0);
242 
243  if (isBranchNode()) {
244 
245  // current node is a branch node
246  const BranchNode* current_branch =
247  static_cast<const BranchNode*>(current_state_->node_);
248 
249  // get child configuration bit pattern
250  ret = octree_->getBranchBitPattern(*current_branch);
251  }
252 
253  return (ret);
254  }
255 
256  /** \brief Method for retrieving a single leaf container from the octree leaf node
257  * \return Reference to container class of leaf node.
258  */
259  const LeafContainer&
261  {
262  assert(octree_ != 0);
263  assert(current_state_ != 0);
264  assert(this->isLeafNode());
265 
266  LeafNode* leaf_node = static_cast<LeafNode*>(current_state_->node_);
267 
268  return leaf_node->getContainer();
269  }
270 
271  /** \brief Method for retrieving a single leaf container from the octree leaf node
272  * \return Reference to container class of leaf node.
273  */
276  {
277  assert(octree_ != 0);
278  assert(current_state_ != 0);
279  assert(this->isLeafNode());
280 
281  LeafNode* leaf_node = static_cast<LeafNode*>(current_state_->node_);
282 
283  return leaf_node->getContainer();
284  }
285 
286  /** \brief Method for retrieving the container from an octree branch node
287  * \return BranchContainer.
288  */
289  const BranchContainer&
291  {
292  assert(octree_ != 0);
293  assert(current_state_ != 0);
294  assert(this->isBranchNode());
295 
296  BranchNode* branch_node = static_cast<BranchNode*>(current_state_->node_);
297 
298  return branch_node->getContainer();
299  }
300 
301  /** \brief Method for retrieving the container from an octree branch node
302  * \return BranchContainer.
303  */
306  {
307  assert(octree_ != 0);
308  assert(current_state_ != 0);
309  assert(this->isBranchNode());
310 
311  BranchNode* branch_node = static_cast<BranchNode*>(current_state_->node_);
312 
313  return branch_node->getContainer();
314  }
315 
316  /** \brief get a integer identifier for current node (note: identifier depends on tree
317  * depth). \return node id.
318  */
319  virtual unsigned long
320  getNodeID() const
321  {
322  unsigned long id = 0;
323 
324  assert(octree_ != 0);
325  assert(current_state_ != 0);
326 
327  if (current_state_) {
328  const OctreeKey& key = getCurrentOctreeKey();
329  // calculate integer id with respect to octree key
330  unsigned int depth = octree_->getTreeDepth();
331  id = static_cast<unsigned long>(key.x) << (depth * 2) |
332  static_cast<unsigned long>(key.y) << (depth * 1) |
333  static_cast<unsigned long>(key.z) << (depth * 0);
334  }
335 
336  return id;
337  }
338 
339 protected:
340  /** \brief Reference to octree class. */
341  OctreeT* octree_;
342 
343  /** \brief Pointer to current iterator state. */
345 
346  /** \brief Maximum octree depth */
347  unsigned int max_octree_depth_;
348 };
349 
350 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
351 /** \brief @b Octree iterator class
352  * \note This class implements a forward iterator for traversing octrees in a
353  * depth-first manner.
354  * \ingroup octree
355  * \author Julius Kammerl (julius@kammerl.de)
356  */
357 template <typename OctreeT>
359 
360 public:
363 
364  /** \brief Empty constructor.
365  * \param[in] max_depth_arg Depth limitation during traversal
366  */
367  explicit OctreeDepthFirstIterator(unsigned int max_depth_arg = 0);
368 
369  /** \brief Constructor.
370  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
371  * root node.
372  * \param[in] max_depth_arg Depth limitation during traversal
373  */
374  explicit OctreeDepthFirstIterator(OctreeT* octree_arg,
375  unsigned int max_depth_arg = 0);
376 
377  /** \brief Constructor.
378  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
379  * root node.
380  * \param[in] max_depth_arg Depth limitation during traversal
381  * \param[in] current_state A pointer to the current iterator state
382  *
383  * \warning For advanced users only.
384  */
386  OctreeT* octree_arg,
387  unsigned int max_depth_arg,
388  IteratorState* current_state,
389  const std::vector<IteratorState>& stack = std::vector<IteratorState>())
390  : OctreeIteratorBase<OctreeT>(octree_arg, max_depth_arg, current_state), stack_(stack)
391  {}
392 
393  /** \brief Copy Constructor.
394  * \param[in] other Another OctreeDepthFirstIterator to copy from
395  */
397  : OctreeIteratorBase<OctreeT>(other), stack_(other.stack_)
398  {
399  this->current_state_ = stack_.size() ? &stack_.back() : NULL;
400  }
401 
402  /** \brief Copy assignment
403  * \param[in] src the iterator to copy into this
404  */
407  {
408 
410 
411  stack_ = src.stack_;
412 
413  if (stack_.size()) {
414  this->current_state_ = &stack_.back();
415  }
416  else {
417  this->current_state_ = 0;
418  }
419 
420  return (*this);
421  }
422 
423  /** \brief Reset the iterator to the root node of the octree
424  */
425  virtual void
426  reset();
427 
428  /** \brief Preincrement operator.
429  * \note recursively step to next octree node
430  */
432  operator++();
433 
434  /** \brief postincrement operator.
435  * \note recursively step to next octree node
436  */
439  {
440  OctreeDepthFirstIterator _Tmp = *this;
441  ++*this;
442  return (_Tmp);
443  }
444 
445  /** \brief Skip all child voxels of current node and return to parent node.
446  */
447  void
448  skipChildVoxels();
449 
450 protected:
451  /** Stack structure. */
452  std::vector<IteratorState> stack_;
453 };
454 
455 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
456 /** \brief @b Octree iterator class
457  * \note This class implements a forward iterator for traversing octrees in a
458  * breadth-first manner.
459  * \ingroup octree
460  * \author Julius Kammerl (julius@kammerl.de)
461  */
462 template <typename OctreeT>
464 public:
465  // public typedefs
468 
469  /** \brief Empty constructor.
470  * \param[in] max_depth_arg Depth limitation during traversal
471  */
472  explicit OctreeBreadthFirstIterator(unsigned int max_depth_arg = 0);
473 
474  /** \brief Constructor.
475  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
476  * root node.
477  * \param[in] max_depth_arg Depth limitation during traversal
478  */
479  explicit OctreeBreadthFirstIterator(OctreeT* octree_arg,
480  unsigned int max_depth_arg = 0);
481 
482  /** \brief Constructor.
483  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
484  * root node.
485  * \param[in] max_depth_arg Depth limitation during traversal
486  * \param[in] current_state A pointer to the current iterator state
487  *
488  * \warning For advanced users only.
489  */
491  OctreeT* octree_arg,
492  unsigned int max_depth_arg,
493  IteratorState* current_state,
494  const std::deque<IteratorState>& fifo = std::deque<IteratorState>())
495  : OctreeIteratorBase<OctreeT>(octree_arg, max_depth_arg, current_state), FIFO_(fifo)
496  {}
497 
498  /** \brief Copy Constructor.
499  * \param[in] other Another OctreeBreadthFirstIterator to copy from
500  */
502  : OctreeIteratorBase<OctreeT>(other), FIFO_(other.FIFO_)
503  {
504  this->current_state_ = FIFO_.size() ? &FIFO_.front() : NULL;
505  }
506 
507  /** \brief Copy operator.
508  * \param[in] src the iterator to copy into this
509  */
512  {
513 
515 
516  FIFO_ = src.FIFO_;
517 
518  if (FIFO_.size()) {
519  this->current_state_ = &FIFO_.front();
520  }
521  else {
522  this->current_state_ = 0;
523  }
524 
525  return (*this);
526  }
527 
528  /** \brief Reset the iterator to the root node of the octree
529  */
530  void
531  reset();
532 
533  /** \brief Preincrement operator.
534  * \note step to next octree node
535  */
537  operator++();
538 
539  /** \brief postincrement operator.
540  * \note step to next octree node
541  */
544  {
545  OctreeBreadthFirstIterator _Tmp = *this;
546  ++*this;
547  return (_Tmp);
548  }
549 
550 protected:
551  /** FIFO list */
552  std::deque<IteratorState> FIFO_;
553 };
554 
555 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
556 /** \brief @b Octree iterator class
557  * \note Iterator over all existing nodes at a given depth. It walks across an octree
558  * in a breadth-first manner.
559  * \ingroup octree
560  * \author Fabien Rozar (fabien.rozar@gmail.com)
561  */
562 template <typename OctreeT>
564 public:
565  // public typedefs
568 
569  /** \brief Empty constructor.
570  */
572 
573  /** \brief Constructor.
574  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
575  * root node.
576  * \param[in] fixed_depth_arg Depth level during traversal
577  */
578  explicit OctreeFixedDepthIterator(OctreeT* octree_arg,
579  unsigned int fixed_depth_arg = 0);
580 
581  /** \brief Constructor.
582  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
583  * root node.
584  * \param[in] fixed_depth_arg Depth level during traversal
585  * \param[in] current_state A pointer to the current iterator state
586  * \param[in] fifo Internal container of octree node to go through
587  *
588  * \warning For advanced users only.
589  */
591  OctreeT* octree_arg,
592  unsigned int fixed_depth_arg,
593  IteratorState* current_state,
594  const std::deque<IteratorState>& fifo = std::deque<IteratorState>())
595  : OctreeBreadthFirstIterator<OctreeT>(
596  octree_arg, fixed_depth_arg, current_state, fifo)
597  , fixed_depth_(fixed_depth_arg)
598  {}
599 
600  /** \brief Copy Constructor.
601  * \param[in] other Another OctreeFixedDepthIterator to copy from
602  */
604  : OctreeBreadthFirstIterator<OctreeT>(other)
605  {
606  this->fixed_depth_ = other.fixed_depth_;
607  }
608 
609  /** \brief Copy assignment.
610  * \param[in] src the iterator to copy into this
611  * \return pointer to the current octree node
612  */
615  {
617  this->fixed_depth_ = src.fixed_depth_;
618 
619  return (*this);
620  }
621 
622  /** \brief Reset the iterator to the first node at the depth given as parameter
623  * \param[in] fixed_depth_arg Depth level during traversal
624  */
625  void
626  reset(unsigned int fixed_depth_arg);
627 
628  /** \brief Reset the iterator to the first node at the current depth
629  */
630  void
632  {
633  this->reset(fixed_depth_);
634  }
635 
636 protected:
638 
639  /** \brief Given level of the node to be iterated */
640  unsigned int fixed_depth_;
641 };
642 
643 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
644 /** \brief Octree leaf node iterator class
645  * \note This class implements a forward iterator for traversing the leaf nodes of an
646  * octree data structure.
647  * \ingroup octree
648  * \author Julius Kammerl (julius@kammerl.de)
649  */
650 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
651 template <typename OctreeT>
655 
656 public:
657  /** \brief Empty constructor.
658  * \param[in] max_depth_arg Depth limitation during traversal
659  */
660  explicit OctreeLeafNodeDepthFirstIterator(unsigned int max_depth_arg = 0)
661  : OctreeDepthFirstIterator<OctreeT>(max_depth_arg)
662  {
663  reset();
664  }
665 
666  /** \brief Constructor.
667  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
668  * root node.
669  * \param[in] max_depth_arg Depth limitation during traversal
670  */
671  explicit OctreeLeafNodeDepthFirstIterator(OctreeT* octree_arg,
672  unsigned int max_depth_arg = 0)
673  : OctreeDepthFirstIterator<OctreeT>(octree_arg, max_depth_arg)
674  {
675  reset();
676  }
677 
678  /** \brief Constructor.
679  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
680  * root node.
681  * \param[in] max_depth_arg Depth limitation during traversal
682  * \param[in] current_state A pointer to the current iterator state
683  *
684  * \warning For advanced users only.
685  */
687  OctreeT* octree_arg,
688  unsigned int max_depth_arg,
689  IteratorState* current_state,
690  const std::vector<IteratorState>& stack = std::vector<IteratorState>())
691  : OctreeDepthFirstIterator<OctreeT>(octree_arg, max_depth_arg, current_state, stack)
692  {}
693 
694  /** \brief Reset the iterator to the root node of the octree
695  */
696  inline void
698  {
700  this->operator++();
701  }
702 
703  /** \brief Preincrement operator.
704  * \note recursively step to next octree leaf node
705  */
708  {
709  do {
711  } while ((this->current_state_) &&
712  (this->current_state_->node_->getNodeType() != LEAF_NODE));
713 
714  return (*this);
715  }
716 
717  /** \brief postincrement operator.
718  * \note step to next octree node
719  */
722  {
724  ++*this;
725  return (_Tmp);
726  }
727 
728  /** \brief *operator.
729  * \return pointer to the current octree leaf node
730  */
732  {
733  // return designated object
734  OctreeNode* ret = 0;
735 
736  if (this->current_state_ &&
737  (this->current_state_->node_->getNodeType() == LEAF_NODE))
738  ret = this->current_state_->node_;
739  return (ret);
740  }
741 };
742 
743 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
744 /** \brief Octree leaf node iterator class
745  * \note This class implements a forward iterator for traversing the leaf nodes of an
746  * octree data structure in the breadth first way.
747  * \ingroup octree
748  * \author Fabien Rozar
749  * (fabien.rozar@gmail.com)
750  */
751 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
752 template <typename OctreeT>
756 
757 public:
758  /** \brief Empty constructor.
759  * \param[in] max_depth_arg Depth limitation during traversal
760  */
761  explicit OctreeLeafNodeBreadthFirstIterator(unsigned int max_depth_arg = 0);
762 
763  /** \brief Constructor.
764  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
765  * root node.
766  * \param[in] max_depth_arg Depth limitation during traversal
767  */
768  explicit OctreeLeafNodeBreadthFirstIterator(OctreeT* octree_arg,
769  unsigned int max_depth_arg = 0);
770 
771  /** \brief Copy constructor.
772  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
773  * root node.
774  * \param[in] max_depth_arg Depth limitation during traversal
775  * \param[in] current_state A pointer to the current iterator state
776  * \param[in] fifo Internal container of octree node to go through
777  *
778  * \warning For advanced users only.
779  */
781  OctreeT* octree_arg,
782  unsigned int max_depth_arg,
783  IteratorState* current_state,
784  const std::deque<IteratorState>& fifo = std::deque<IteratorState>());
785 
786  /** \brief Reset the iterator to the first leaf in the breadth first way.
787  */
788  inline void
789  reset();
790 
791  /** \brief Preincrement operator.
792  * \note recursively step to next octree leaf node
793  */
795  operator++();
796 
797  /** \brief Postincrement operator.
798  * \note step to next octree node
799  */
801  operator++(int);
802 };
803 
804 } // namespace octree
805 } // namespace pcl
806 
807 /*
808  * Note: Since octree iterators depend on octrees, don't precompile them.
809  */
810 #include <pcl/octree/impl/octree_iterator.hpp>
bool isLeafNode() const
check if current node is a branch node
OctreeBreadthFirstIterator & operator=(const OctreeBreadthFirstIterator &src)
Copy operator.
void reset()
Reset iterator.
typename OctreeIteratorBase< OctreeT >::LeafNode LeafNode
void reset()
Reset the iterator to the first node at the current depth.
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
const BranchContainer & getBranchContainer() const
Method for retrieving the container from an octree branch node.
std::deque< IteratorState > FIFO_
FIFO list.
typename OctreeIteratorBase< OctreeT >::LeafNode LeafNode
bool isBranchNode() const
check if current node is a branch node
OctreeNode * operator*() const
*operator.
const LeafContainer & getLeafContainer() const
Method for retrieving a single leaf container from the octree leaf node.
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state)
Constructor.
OctreeNode * operator*() const
*operator.
std::vector< IteratorState > stack_
Stack structure.
IteratorState * current_state_
Pointer to current iterator state.
OctreeBreadthFirstIterator operator++(int)
postincrement operator.
typename OctreeT::LeafContainer LeafContainer
OctreeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state, const std::vector< IteratorState > &stack=std::vector< IteratorState >())
Constructor.
OctreeFixedDepthIterator & operator=(const OctreeFixedDepthIterator &src)
Copy assignment.
OctreeFixedDepthIterator(const OctreeFixedDepthIterator &other)
Copy Constructor.
LeafContainer & getLeafContainer()
Method for retrieving a single leaf container from the octree leaf node.
unsigned int max_octree_depth_
Maximum octree depth.
unsigned int fixed_depth_
Given level of the node to be iterated.
void reset()
Reset the iterator to the root node of the octree.
typename OctreeT::BranchNode BranchNode
virtual void reset()
Reset the iterator to the root node of the octree.
unsigned int getCurrentOctreeDepth() const
Get the current depth level of octree.
bool operator!=(const OctreeIteratorBase &other) const
Inequal comparison operator.
OctreeIteratorBase(unsigned int max_depth_arg=0)
Empty constructor.
OctreeNode * getCurrentOctreeNode() const
Get the current octree node.
OctreeLeafNodeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state, const std::vector< IteratorState > &stack=std::vector< IteratorState >())
Constructor.
OctreeDepthFirstIterator operator++(int)
postincrement operator.
char getNodeConfiguration() const
Get bit pattern of children configuration of current node.
Octree leaf node iterator class.
OctreeLeafNodeDepthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
OctreeBreadthFirstIterator(const OctreeBreadthFirstIterator &other)
Copy Constructor.
OctreeFixedDepthIterator(OctreeT *octree_arg, unsigned int fixed_depth_arg, IteratorState *current_state, const std::deque< IteratorState > &fifo=std::deque< IteratorState >())
Constructor.
virtual unsigned long getNodeID() const
get a integer identifier for current node (note: identifier depends on tree depth).
typename OctreeT::BranchContainer BranchContainer
Octree key class
Definition: octree_key.h:52
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
OctreeDepthFirstIterator(const OctreeDepthFirstIterator &other)
Copy Constructor.
OctreeT * octree_
Reference to octree class.
OctreeDepthFirstIterator & operator++()
Preincrement operator.
Abstract octree iterator class
typename OctreeT::LeafNode LeafNode
OctreeDepthFirstIterator & operator=(const OctreeDepthFirstIterator &src)
Copy assignment.
virtual ~OctreeIteratorBase()
Empty deconstructor.
bool operator==(const OctreeIteratorBase &other) const
Equal comparison operator.
bool operator==(const PCLHeader &lhs, const PCLHeader &rhs)
Definition: PCLHeader.h:37
OctreeLeafNodeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
OctreeBreadthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state, const std::deque< IteratorState > &fifo=std::deque< IteratorState >())
Constructor.
OctreeLeafNodeDepthFirstIterator & operator++()
Preincrement operator.
Abstract octree node class
Definition: octree_nodes.h:63
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
OctreeLeafNodeDepthFirstIterator operator++(int)
postincrement operator.
BranchContainer & getBranchContainer()
Method for retrieving the container from an octree branch node.