Point Cloud Library (PCL)  1.9.1
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 #ifndef PCL_OCTREE_ITERATOR_H
41 #define PCL_OCTREE_ITERATOR_H
42 
43 #include <cstddef>
44 #include <vector>
45 #include <deque>
46 
47 #include <pcl/octree/octree_nodes.h>
48 #include <pcl/octree/octree_key.h>
49 
50 #include <iterator>
51 
52 // Ignore warnings in the above headers
53 #ifdef __GNUC__
54 #pragma GCC system_header
55 #endif
56 
57 namespace pcl
58 {
59  namespace octree
60  {
61 
62  // Octree iterator state pushed on stack/list
63  struct IteratorState{
66  unsigned int depth_;
67  };
68 
69 
70  /** \brief @b Abstract octree iterator class
71  * \note Octree iterator base class
72  * \ingroup octree
73  * \author Julius Kammerl (julius@kammerl.de)
74  */
75  template<typename OctreeT>
76  class OctreeIteratorBase : public std::iterator<std::forward_iterator_tag, const OctreeNode, void,
77  const OctreeNode*, const OctreeNode&>
78  {
79  public:
80 
81  typedef typename OctreeT::LeafNode LeafNode;
82  typedef typename OctreeT::BranchNode BranchNode;
83 
84  typedef typename OctreeT::LeafContainer LeafContainer;
85  typedef typename OctreeT::BranchContainer BranchContainer;
86 
87  /** \brief Empty constructor.
88  */
89  explicit
90  OctreeIteratorBase (unsigned int max_depth_arg = 0) :
91  octree_ (0), current_state_(0), max_octree_depth_(max_depth_arg)
92  {
93  this->reset ();
94  }
95 
96  /** \brief Constructor.
97  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
98  * \param[in] max_depth_arg Depth limitation during traversal
99  */
100  explicit
101  OctreeIteratorBase (OctreeT* octree_arg, unsigned int max_depth_arg = 0) :
102  octree_ (octree_arg), current_state_(0), max_octree_depth_(max_depth_arg)
103  {
104  this->reset ();
105  }
106 
107  /** \brief Constructor.
108  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
109  * \param[in] max_depth_arg Depth limitation during traversal
110  * \param[in] current_state A pointer to the current iterator state
111  *
112  * \warning For advanced users only.
113  */
114  explicit
115  OctreeIteratorBase (OctreeT* octree_arg,
116  unsigned int max_depth_arg,
117  IteratorState* current_state)
118  : octree_(octree_arg)
119  , current_state_ (current_state)
120  , max_octree_depth_ (max_depth_arg)
121  {}
122 
123  /** \brief Empty deconstructor. */
124  virtual
126  {
127  }
128 
129  /** \brief Equal comparison operator
130  * \param[in] other OctreeIteratorBase to compare with
131  */
132  bool operator==(const OctreeIteratorBase& other) const
133  {
134  if (this == &other) // same object
135  return true;
136  if (octree_ != other.octree_) // refer to different octrees
137  return false;
138  if (!current_state_ && !other.current_state_) // both are end iterators
139  return true;
140  if (max_octree_depth_ == other.max_octree_depth_ &&
141  current_state_ && other.current_state_ && // null dereference protection
143  return true;
144  return false;
145  }
146 
147  /** \brief Inequal comparison operator
148  * \param[in] other OctreeIteratorBase to compare with
149  */
150  bool operator!=(const OctreeIteratorBase& other) const
151  {
152  return !operator== (other);
153  }
154 
155  /** \brief Reset iterator */
156  inline void reset ()
157  {
158  current_state_ = 0;
159  if (octree_ && (!max_octree_depth_))
160  {
161  max_octree_depth_ = octree_->getTreeDepth();
162  }
163  }
164 
165  /** \brief Get octree key for the current iterator octree node
166  * \return octree key of current node
167  */
168  inline const OctreeKey&
170  {
171  assert(octree_!=0);
172  assert(current_state_!=0);
173 
174  return (current_state_->key_);
175  }
176 
177  /** \brief Get the current depth level of octree
178  * \return depth level
179  */
180  inline unsigned int
182  {
183  assert(octree_!=0);
184  assert(current_state_!=0);
185 
186  return (current_state_->depth_);
187  }
188 
189  /** \brief Get the current octree node
190  * \return pointer to current octree node
191  */
192  inline OctreeNode*
194  {
195  assert(octree_!=0);
196  assert(current_state_!=0);
197 
198  return (current_state_->node_);
199  }
200 
201 
202  /** \brief check if current node is a branch node
203  * \return true if current node is a branch node, false otherwise
204  */
205  inline bool
206  isBranchNode () const
207  {
208  assert(octree_!=0);
209  assert(current_state_!=0);
210 
211  return (current_state_->node_->getNodeType () == BRANCH_NODE);
212  }
213 
214  /** \brief check if current node is a branch node
215  * \return true if current node is a branch node, false otherwise
216  */
217  inline bool
218  isLeafNode () const
219  {
220  assert(octree_!=0);
221  assert(current_state_!=0);
222 
223  return (current_state_->node_->getNodeType () == LEAF_NODE);
224  }
225 
226  /** \brief *operator.
227  * \return pointer to the current octree node
228  */
229  inline OctreeNode*
230  operator* () const
231  { // return designated object
232  if (octree_ && current_state_)
233  {
234  return (current_state_->node_);
235  } else
236  {
237  return 0;
238  }
239  }
240 
241  /** \brief Get bit pattern of children configuration of current node
242  * \return bit pattern (byte) describing the existence of 8 children of the current node
243  */
244  inline char
246  {
247  char ret = 0;
248 
249  assert(octree_!=0);
250  assert(current_state_!=0);
251 
252  if (isBranchNode ())
253  {
254 
255  // current node is a branch node
256  const BranchNode* current_branch = static_cast<const BranchNode*> (current_state_->node_);
257 
258  // get child configuration bit pattern
259  ret = octree_->getBranchBitPattern (*current_branch);
260 
261  }
262 
263  return (ret);
264  }
265 
266  /** \brief Method for retrieving a single leaf container from the octree leaf node
267  * \return Reference to container class of leaf node.
268  */
269  const LeafContainer&
271  {
272  assert(octree_!=0);
273  assert(current_state_!=0);
274  assert(this->isLeafNode());
275 
276  LeafNode* leaf_node = static_cast<LeafNode*>(current_state_->node_);
277 
278  return leaf_node->getContainer();
279  }
280 
281  /** \brief Method for retrieving a single leaf container from the octree leaf node
282  * \return Reference to container class of leaf node.
283  */
286  {
287  assert(octree_!=0);
288  assert(current_state_!=0);
289  assert(this->isLeafNode());
290 
291  LeafNode* leaf_node = static_cast<LeafNode*>(current_state_->node_);
292 
293  return leaf_node->getContainer();
294  }
295 
296  /** \brief Method for retrieving the container from an octree branch node
297  * \return BranchContainer.
298  */
299  const BranchContainer&
301  {
302  assert(octree_!=0);
303  assert(current_state_!=0);
304  assert(this->isBranchNode());
305 
306  BranchNode* branch_node = static_cast<BranchNode*>(current_state_->node_);
307 
308  return branch_node->getContainer();
309  }
310 
311  /** \brief Method for retrieving the container from an octree branch node
312  * \return BranchContainer.
313  */
316  {
317  assert(octree_!=0);
318  assert(current_state_!=0);
319  assert(this->isBranchNode());
320 
321  BranchNode* branch_node = static_cast<BranchNode*>(current_state_->node_);
322 
323  return branch_node->getContainer();
324  }
325 
326  /** \brief get a integer identifier for current node (note: identifier depends on tree depth).
327  * \return node id.
328  */
329  virtual unsigned long
330  getNodeID () const
331  {
332  unsigned long id = 0;
333 
334  assert(octree_!=0);
335  assert(current_state_!=0);
336 
337  if (current_state_)
338  {
339  const OctreeKey& key = getCurrentOctreeKey();
340  // calculate integer id with respect to octree key
341  unsigned int depth = octree_->getTreeDepth ();
342  id = static_cast<unsigned long> (key.x) << (depth * 2)
343  | static_cast<unsigned long> (key.y) << (depth * 1)
344  | static_cast<unsigned long> (key.z) << (depth * 0);
345  }
346 
347  return id;
348  }
349 
350  protected:
351  /** \brief Reference to octree class. */
352  OctreeT* octree_;
353 
354  /** \brief Pointer to current iterator state. */
356 
357  /** \brief Maximum octree depth */
358  unsigned int max_octree_depth_;
359  };
360 
361  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
362  /** \brief @b Octree iterator class
363  * \note This class implements a forward iterator for traversing octrees in a depth-first manner.
364  * \ingroup octree
365  * \author Julius Kammerl (julius@kammerl.de)
366  */
367  template<typename OctreeT>
369  {
370 
371  public:
372 
375 
376  /** \brief Empty constructor.
377  * \param[in] max_depth_arg Depth limitation during traversal
378  */
379  explicit
380  OctreeDepthFirstIterator (unsigned int max_depth_arg = 0);
381 
382  /** \brief Constructor.
383  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
384  * \param[in] max_depth_arg Depth limitation during traversal
385  */
386  explicit
387  OctreeDepthFirstIterator (OctreeT* octree_arg, unsigned int max_depth_arg = 0);
388 
389  /** \brief Constructor.
390  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
391  * \param[in] max_depth_arg Depth limitation during traversal
392  * \param[in] current_state A pointer to the current iterator state
393  *
394  * \warning For advanced users only.
395  */
396  explicit
397  OctreeDepthFirstIterator (OctreeT* octree_arg,
398  unsigned int max_depth_arg,
399  IteratorState* current_state,
400  const std::vector<IteratorState>& stack = std::vector<IteratorState> ())
401  : OctreeIteratorBase<OctreeT> (octree_arg, max_depth_arg, current_state)
402  , stack_ (stack)
403  {}
404 
405  /** \brief Copy Constructor.
406  * \param[in] other Another OctreeDepthFirstIterator to copy from
407  */
409  : OctreeIteratorBase<OctreeT> (other)
410  , stack_ (other.stack_)
411  {
412  this->current_state_ = stack_.size ()? &stack_.back () : NULL;
413  }
414 
415  /** \brief Copy assignment
416  * \param[in] src the iterator to copy into this
417  */
420  {
421 
423 
424  stack_ = src.stack_;
425 
426  if (stack_.size())
427  {
428  this->current_state_ = &stack_.back ();
429  } else
430  {
431  this->current_state_ = 0;
432  }
433 
434  return (*this);
435  }
436 
437  /** \brief Reset the iterator to the root node of the octree
438  */
439  virtual void
440  reset ();
441 
442  /** \brief Preincrement operator.
443  * \note recursively step to next octree node
444  */
446  operator++ ();
447 
448  /** \brief postincrement operator.
449  * \note recursively step to next octree node
450  */
453  {
454  OctreeDepthFirstIterator _Tmp = *this;
455  ++*this;
456  return (_Tmp);
457  }
458 
459  /** \brief Skip all child voxels of current node and return to parent node.
460  */
461  void
462  skipChildVoxels ();
463 
464  protected:
465  /** Stack structure. */
466  std::vector<IteratorState> stack_;
467  };
468 
469  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
470  /** \brief @b Octree iterator class
471  * \note This class implements a forward iterator for traversing octrees in a breadth-first manner.
472  * \ingroup octree
473  * \author Julius Kammerl (julius@kammerl.de)
474  */
475  template<typename OctreeT>
477  {
478  public:
479  // public typedefs
482 
483  /** \brief Empty constructor.
484  * \param[in] max_depth_arg Depth limitation during traversal
485  */
486  explicit
487  OctreeBreadthFirstIterator (unsigned int max_depth_arg = 0);
488 
489  /** \brief Constructor.
490  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
491  * \param[in] max_depth_arg Depth limitation during traversal
492  */
493  explicit
494  OctreeBreadthFirstIterator (OctreeT* octree_arg, unsigned int max_depth_arg = 0);
495 
496  /** \brief Constructor.
497  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
498  * \param[in] max_depth_arg Depth limitation during traversal
499  * \param[in] current_state A pointer to the current iterator state
500  *
501  * \warning For advanced users only.
502  */
503  explicit
504  OctreeBreadthFirstIterator (OctreeT* octree_arg,
505  unsigned int max_depth_arg,
506  IteratorState* current_state,
507  const std::deque<IteratorState>& fifo = std::deque<IteratorState> ())
508  : OctreeIteratorBase<OctreeT> (octree_arg, max_depth_arg, current_state)
509  , FIFO_ (fifo)
510  {}
511 
512  /** \brief Copy Constructor.
513  * \param[in] other Another OctreeBreadthFirstIterator to copy from
514  */
516  : OctreeIteratorBase<OctreeT> (other)
517  , FIFO_ (other.FIFO_)
518  {
519  this->current_state_ = FIFO_.size ()? &FIFO_.front () : NULL;
520  }
521 
522  /** \brief Copy operator.
523  * \param[in] src the iterator to copy into this
524  */
527  {
528 
530 
531  FIFO_ = src.FIFO_;
532 
533  if (FIFO_.size())
534  {
535  this->current_state_ = &FIFO_.front();
536  } else
537  {
538  this->current_state_ = 0;
539  }
540 
541  return (*this);
542  }
543 
544  /** \brief Reset the iterator to the root node of the octree
545  */
546  void
547  reset ();
548 
549  /** \brief Preincrement operator.
550  * \note step to next octree node
551  */
553  operator++ ();
554 
555  /** \brief postincrement operator.
556  * \note step to next octree node
557  */
560  {
561  OctreeBreadthFirstIterator _Tmp = *this;
562  ++*this;
563  return (_Tmp);
564  }
565 
566  protected:
567  /** FIFO list */
568  std::deque<IteratorState> FIFO_;
569  };
570 
571  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
572  /** \brief @b Octree iterator class
573  * \note Iterator over all existing nodes at a given depth. It walks across an octree
574  * in a breadth-first manner.
575  * \ingroup octree
576  * \author Fabien Rozar (fabien.rozar@gmail.com)
577  */
578  template<typename OctreeT>
580  {
581  public:
582 
583  // public typedefs
586 
587  /** \brief Empty constructor.
588  */
590 
591  /** \brief Constructor.
592  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
593  * \param[in] fixed_depth_arg Depth level during traversal
594  */
595  explicit
596  OctreeFixedDepthIterator (OctreeT* octree_arg, unsigned int fixed_depth_arg = 0);
597 
598  /** \brief Constructor.
599  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
600  * \param[in] fixed_depth_arg Depth level during traversal
601  * \param[in] current_state A pointer to the current iterator state
602  * \param[in] fifo Internal container of octree node to go through
603  *
604  * \warning For advanced users only.
605  */
606  OctreeFixedDepthIterator (OctreeT* octree_arg,
607  unsigned int fixed_depth_arg,
608  IteratorState* current_state,
609  const std::deque<IteratorState>& fifo = std::deque<IteratorState> ())
610  : OctreeBreadthFirstIterator<OctreeT> (octree_arg, fixed_depth_arg, current_state, fifo)
611  , fixed_depth_ (fixed_depth_arg)
612  {}
613 
614  /** \brief Copy Constructor.
615  * \param[in] other Another OctreeFixedDepthIterator to copy from
616  */
618  : OctreeBreadthFirstIterator<OctreeT> (other)
619  {
620  this->fixed_depth_ = other.fixed_depth_;
621  }
622 
623  /** \brief Copy assignment.
624  * \param[in] src the iterator to copy into this
625  * \return pointer to the current octree node
626  */
629  {
631  this->fixed_depth_ = src.fixed_depth_;
632 
633  return (*this);
634  }
635 
636  /** \brief Reset the iterator to the first node at the depth given as parameter
637  * \param[in] fixed_depth_arg Depth level during traversal
638  */
639  void
640  reset (unsigned int fixed_depth_arg);
641 
642  /** \brief Reset the iterator to the first node at the current depth
643  */
644  void
645  reset ()
646  {
647  this->reset (fixed_depth_);
648  }
649 
650  protected:
652 
653  /** \brief Given level of the node to be iterated */
654  unsigned int fixed_depth_;
655  };
656 
657  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
658  /** \brief Octree leaf node iterator class
659  * \note This class implements a forward iterator for traversing the leaf nodes of an octree data structure.
660  * \ingroup octree
661  * \author Julius Kammerl (julius@kammerl.de)
662  */
663  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
664  template<typename OctreeT>
666  {
669 
670  public:
671  /** \brief Empty constructor.
672  * \param[in] max_depth_arg Depth limitation during traversal
673  */
674  explicit
675  OctreeLeafNodeDepthFirstIterator (unsigned int max_depth_arg = 0) :
676  OctreeDepthFirstIterator<OctreeT> (max_depth_arg)
677  {
678  reset ();
679  }
680 
681  /** \brief Constructor.
682  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
683  * \param[in] max_depth_arg Depth limitation during traversal
684  */
685  explicit
686  OctreeLeafNodeDepthFirstIterator (OctreeT* octree_arg, unsigned int max_depth_arg = 0) :
687  OctreeDepthFirstIterator<OctreeT> (octree_arg, max_depth_arg)
688  {
689  reset ();
690  }
691 
692  /** \brief Constructor.
693  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
694  * \param[in] max_depth_arg Depth limitation during traversal
695  * \param[in] current_state A pointer to the current iterator state
696  *
697  * \warning For advanced users only.
698  */
699  explicit
700  OctreeLeafNodeDepthFirstIterator (OctreeT* octree_arg,
701  unsigned int max_depth_arg,
702  IteratorState* current_state,
703  const std::vector<IteratorState>& stack = std::vector<IteratorState> ())
704  : OctreeDepthFirstIterator<OctreeT> (octree_arg,
705  max_depth_arg,
706  current_state,
707  stack)
708  {}
709 
710  /** \brief Reset the iterator to the root node of the octree
711  */
712  inline void
713  reset ()
714  {
716  this->operator++ ();
717  }
718 
719  /** \brief Preincrement operator.
720  * \note recursively step to next octree leaf node
721  */
724  {
725  do
726  {
728  } while ((this->current_state_) && (this->current_state_->node_->getNodeType () != LEAF_NODE));
729 
730  return (*this);
731  }
732 
733  /** \brief postincrement operator.
734  * \note step to next octree node
735  */
738  {
740  ++*this;
741  return (_Tmp);
742  }
743 
744  /** \brief *operator.
745  * \return pointer to the current octree leaf node
746  */
747  OctreeNode*
748  operator* () const
749  {
750  // return designated object
751  OctreeNode* ret = 0;
752 
753  if (this->current_state_ && (this->current_state_->node_->getNodeType () == LEAF_NODE))
754  ret = this->current_state_->node_;
755  return (ret);
756  }
757  };
758 
759  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
760  /** \brief Octree leaf node iterator class
761  * \note This class implements a forward iterator for traversing the leaf nodes of an octree data structure
762  * in the breadth first way.
763  * \ingroup octree
764  * \author Fabien Rozar (fabien.rozar@gmail.com)
765  */
766  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
767  template<typename OctreeT>
769  {
772 
773  public:
774  /** \brief Empty constructor.
775  * \param[in] max_depth_arg Depth limitation during traversal
776  */
777  explicit
778  OctreeLeafNodeBreadthFirstIterator (unsigned int max_depth_arg = 0);
779 
780  /** \brief Constructor.
781  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
782  * \param[in] max_depth_arg Depth limitation during traversal
783  */
784  explicit
785  OctreeLeafNodeBreadthFirstIterator (OctreeT* octree_arg, unsigned int max_depth_arg = 0);
786 
787  /** \brief Copy constructor.
788  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node.
789  * \param[in] max_depth_arg Depth limitation during traversal
790  * \param[in] current_state A pointer to the current iterator state
791  * \param[in] fifo Internal container of octree node to go through
792  *
793  * \warning For advanced users only.
794  */
795  explicit
796  OctreeLeafNodeBreadthFirstIterator (OctreeT* octree_arg,
797  unsigned int max_depth_arg,
798  IteratorState* current_state,
799  const std::deque<IteratorState>& fifo = std::deque<IteratorState> ());
800 
801  /** \brief Reset the iterator to the first leaf in the breadth first way.
802  */
803  inline void
804  reset ();
805 
806  /** \brief Preincrement operator.
807  * \note recursively step to next octree leaf node
808  */
810  operator++ ();
811 
812 
813  /** \brief Postincrement operator.
814  * \note step to next octree node
815  */
817  operator++ (int);
818  };
819 
820  }
821 }
822 
823 /*
824  * Note: Since octree iterators depend on octrees, don't precompile them.
825  */
826 #include <pcl/octree/impl/octree_iterator.hpp>
827 
828 #endif
829 
pcl::octree::OctreeIteratorBase::octree_
OctreeT * octree_
Reference to octree class.
Definition: octree_iterator.h:352
pcl::octree::OctreeIteratorBase::OctreeIteratorBase
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
Definition: octree_iterator.h:101
pcl
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
pcl::octree::OctreeFixedDepthIterator::OctreeFixedDepthIterator
OctreeFixedDepthIterator(OctreeT *octree_arg, unsigned int fixed_depth_arg, IteratorState *current_state, const std::deque< IteratorState > &fifo=std::deque< IteratorState >())
Constructor.
Definition: octree_iterator.h:606
pcl::octree::OctreeKey::z
uint32_t z
Definition: octree_key.h:153
pcl::octree::OctreeIteratorBase::max_octree_depth_
unsigned int max_octree_depth_
Maximum octree depth.
Definition: octree_iterator.h:358
pcl::octree::OctreeBreadthFirstIterator::OctreeBreadthFirstIterator
OctreeBreadthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
Definition: octree_iterator.hpp:174
pcl::octree::OctreeLeafNodeBreadthFirstIterator::reset
void reset()
Reset the iterator to the first leaf in the breadth first way.
Definition: octree_iterator.hpp:355
pcl::octree::OctreeIteratorBase::operator*
OctreeNode * operator*() const
*operator.
Definition: octree_iterator.h:230
pcl::octree::OctreeIteratorBase::LeafNode
OctreeT::LeafNode LeafNode
Definition: octree_iterator.h:81
pcl::octree::OctreeNode::getNodeType
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
pcl::octree::OctreeIteratorBase::getNodeConfiguration
char getNodeConfiguration() const
Get bit pattern of children configuration of current node.
Definition: octree_iterator.h:245
pcl::octree::OctreeIteratorBase::getLeafContainer
LeafContainer & getLeafContainer()
Method for retrieving a single leaf container from the octree leaf node.
Definition: octree_iterator.h:285
pcl::octree::OctreeLeafNodeDepthFirstIterator::OctreeLeafNodeDepthFirstIterator
OctreeLeafNodeDepthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
Definition: octree_iterator.h:675
pcl::octree::OctreeLeafNodeDepthFirstIterator::operator++
OctreeLeafNodeDepthFirstIterator & operator++()
Preincrement operator.
Definition: octree_iterator.h:723
pcl::octree::OctreeIteratorBase::getCurrentOctreeNode
OctreeNode * getCurrentOctreeNode() const
Get the current octree node.
Definition: octree_iterator.h:193
pcl::octree::OctreeIteratorBase::OctreeIteratorBase
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state)
Constructor.
Definition: octree_iterator.h:115
pcl::octree::OctreeDepthFirstIterator::operator=
OctreeDepthFirstIterator & operator=(const OctreeDepthFirstIterator &src)
Copy assignment.
Definition: octree_iterator.h:419
pcl::octree::OctreeBreadthFirstIterator::FIFO_
std::deque< IteratorState > FIFO_
FIFO list.
Definition: octree_iterator.h:568
pcl::octree::OctreeFixedDepthIterator::OctreeFixedDepthIterator
OctreeFixedDepthIterator(const OctreeFixedDepthIterator &other)
Copy Constructor.
Definition: octree_iterator.h:617
pcl::octree::OctreeKey
Octree key class
Definition: octree_key.h:51
pcl::octree::OctreeIteratorBase::isLeafNode
bool isLeafNode() const
check if current node is a branch node
Definition: octree_iterator.h:218
pcl::octree::OctreeDepthFirstIterator::OctreeDepthFirstIterator
OctreeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state, const std::vector< IteratorState > &stack=std::vector< IteratorState >())
Constructor.
Definition: octree_iterator.h:397
pcl::octree::OctreeNode
Abstract octree node class
Definition: octree_nodes.h:68
pcl::octree::OctreeDepthFirstIterator::LeafNode
OctreeIteratorBase< OctreeT >::LeafNode LeafNode
Definition: octree_iterator.h:373
pcl::octree::OctreeLeafNodeBreadthFirstIterator::operator++
OctreeLeafNodeBreadthFirstIterator & operator++()
Preincrement operator.
Definition: octree_iterator.hpp:364
pcl::octree::OctreeLeafNodeBreadthFirstIterator::OctreeLeafNodeBreadthFirstIterator
OctreeLeafNodeBreadthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
Definition: octree_iterator.hpp:327
pcl::octree::OctreeBreadthFirstIterator::reset
void reset()
Reset the iterator to the root node of the octree.
Definition: octree_iterator.hpp:196
pcl::octree::LEAF_NODE
@ LEAF_NODE
Definition: octree_nodes.h:60
pcl::octree::OctreeIteratorBase::current_state_
IteratorState * current_state_
Pointer to current iterator state.
Definition: octree_iterator.h:355
pcl::octree::OctreeIteratorBase::operator!=
bool operator!=(const OctreeIteratorBase &other) const
Inequal comparison operator.
Definition: octree_iterator.h:150
pcl::octree::OctreeFixedDepthIterator::operator=
OctreeFixedDepthIterator & operator=(const OctreeFixedDepthIterator &src)
Copy assignment.
Definition: octree_iterator.h:628
pcl::octree::BRANCH_NODE
@ BRANCH_NODE
Definition: octree_nodes.h:60
pcl::octree::OctreeIteratorBase::getLeafContainer
const LeafContainer & getLeafContainer() const
Method for retrieving a single leaf container from the octree leaf node.
Definition: octree_iterator.h:270
pcl::octree::OctreeDepthFirstIterator::skipChildVoxels
void skipChildVoxels()
Skip all child voxels of current node and return to parent node.
Definition: octree_iterator.hpp:95
pcl::octree::OctreeIteratorBase::isBranchNode
bool isBranchNode() const
check if current node is a branch node
Definition: octree_iterator.h:206
pcl::octree::IteratorState
Definition: octree_iterator.h:63
pcl::octree::OctreeIteratorBase::~OctreeIteratorBase
virtual ~OctreeIteratorBase()
Empty deconstructor.
Definition: octree_iterator.h:125
pcl::octree::OctreeIteratorBase
Abstract octree iterator class
Definition: octree_iterator.h:76
pcl::octree::OctreeBreadthFirstIterator
Octree iterator class
Definition: octree_iterator.h:476
pcl::octree::OctreeLeafNodeDepthFirstIterator::OctreeLeafNodeDepthFirstIterator
OctreeLeafNodeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state, const std::vector< IteratorState > &stack=std::vector< IteratorState >())
Constructor.
Definition: octree_iterator.h:700
pcl::octree::OctreeDepthFirstIterator::reset
virtual void reset()
Reset the iterator to the root node of the octree.
Definition: octree_iterator.hpp:68
pcl::octree::OctreeDepthFirstIterator::operator++
OctreeDepthFirstIterator & operator++()
Preincrement operator.
Definition: octree_iterator.hpp:121
pcl::octree::OctreeLeafNodeDepthFirstIterator::reset
void reset()
Reset the iterator to the root node of the octree.
Definition: octree_iterator.h:713
pcl::octree::OctreeIteratorBase::getNodeID
virtual unsigned long getNodeID() const
get a integer identifier for current node (note: identifier depends on tree depth).
Definition: octree_iterator.h:330
pcl::octree::OctreeBreadthFirstIterator::OctreeBreadthFirstIterator
OctreeBreadthFirstIterator(const OctreeBreadthFirstIterator &other)
Copy Constructor.
Definition: octree_iterator.h:515
pcl::octree::OctreeLeafNodeDepthFirstIterator
Octree leaf node iterator class.
Definition: octree_iterator.h:665
pcl::octree::OctreeDepthFirstIterator
Octree iterator class
Definition: octree_iterator.h:368
pcl::octree::OctreeDepthFirstIterator::stack_
std::vector< IteratorState > stack_
Stack structure.
Definition: octree_iterator.h:466
pcl::octree::OctreeDepthFirstIterator::OctreeDepthFirstIterator
OctreeDepthFirstIterator(const OctreeDepthFirstIterator &other)
Copy Constructor.
Definition: octree_iterator.h:408
pcl::octree::OctreeIteratorBase::getBranchContainer
const BranchContainer & getBranchContainer() const
Method for retrieving the container from an octree branch node.
Definition: octree_iterator.h:300
pcl::octree::OctreeFixedDepthIterator::OctreeFixedDepthIterator
OctreeFixedDepthIterator()
Empty constructor.
Definition: octree_iterator.hpp:275
pcl::octree::OctreeIteratorBase::operator==
bool operator==(const OctreeIteratorBase &other) const
Equal comparison operator.
Definition: octree_iterator.h:132
pcl::octree::OctreeFixedDepthIterator
Octree iterator class
Definition: octree_iterator.h:579
pcl::octree::OctreeLeafNodeBreadthFirstIterator
Octree leaf node iterator class.
Definition: octree_iterator.h:768
pcl::octree::OctreeIteratorBase::BranchContainer
OctreeT::BranchContainer BranchContainer
Definition: octree_iterator.h:85
pcl::octree::OctreeBreadthFirstIterator::operator++
OctreeBreadthFirstIterator & operator++()
Preincrement operator.
Definition: octree_iterator.hpp:220
pcl::octree::OctreeIteratorBase::getBranchContainer
BranchContainer & getBranchContainer()
Method for retrieving the container from an octree branch node.
Definition: octree_iterator.h:315
pcl::octree::IteratorState::depth_
unsigned int depth_
Definition: octree_iterator.h:66
pcl::octree::OctreeIteratorBase::getCurrentOctreeDepth
unsigned int getCurrentOctreeDepth() const
Get the current depth level of octree.
Definition: octree_iterator.h:181
pcl::octree::OctreeLeafNodeDepthFirstIterator::operator*
OctreeNode * operator*() const
*operator.
Definition: octree_iterator.h:748
pcl::octree::OctreeIteratorBase::OctreeIteratorBase
OctreeIteratorBase(unsigned int max_depth_arg=0)
Empty constructor.
Definition: octree_iterator.h:90
pcl::octree::OctreeBreadthFirstIterator::LeafNode
OctreeIteratorBase< OctreeT >::LeafNode LeafNode
Definition: octree_iterator.h:481
pcl::octree::OctreeBreadthFirstIterator::BranchNode
OctreeIteratorBase< OctreeT >::BranchNode BranchNode
Definition: octree_iterator.h:480
pcl::octree::OctreeIteratorBase::BranchNode
OctreeT::BranchNode BranchNode
Definition: octree_iterator.h:82
pcl::octree::OctreeFixedDepthIterator::reset
void reset()
Reset the iterator to the first node at the current depth.
Definition: octree_iterator.h:645
pcl::octree::IteratorState::key_
OctreeKey key_
Definition: octree_iterator.h:65
pcl::octree::OctreeIteratorBase::LeafContainer
OctreeT::LeafContainer LeafContainer
Definition: octree_iterator.h:84
pcl::octree::OctreeDepthFirstIterator::BranchNode
OctreeIteratorBase< OctreeT >::BranchNode BranchNode
Definition: octree_iterator.h:374
pcl::octree::OctreeKey::y
uint32_t y
Definition: octree_key.h:152
pcl::octree::IteratorState::node_
OctreeNode * node_
Definition: octree_iterator.h:64
pcl::octree::OctreeLeafNodeDepthFirstIterator::OctreeLeafNodeDepthFirstIterator
OctreeLeafNodeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
Definition: octree_iterator.h:686
pcl::octree::OctreeDepthFirstIterator::OctreeDepthFirstIterator
OctreeDepthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
Definition: octree_iterator.hpp:50
pcl::octree::OctreeFixedDepthIterator::fixed_depth_
unsigned int fixed_depth_
Given level of the node to be iterated.
Definition: octree_iterator.h:654
pcl::octree::OctreeKey::x
uint32_t x
Definition: octree_key.h:151
pcl::octree::OctreeBreadthFirstIterator::operator=
OctreeBreadthFirstIterator & operator=(const OctreeBreadthFirstIterator &src)
Copy operator.
Definition: octree_iterator.h:526
pcl::octree::OctreeBreadthFirstIterator::OctreeBreadthFirstIterator
OctreeBreadthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state, const std::deque< IteratorState > &fifo=std::deque< IteratorState >())
Constructor.
Definition: octree_iterator.h:504
pcl::octree::OctreeIteratorBase::getCurrentOctreeKey
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
Definition: octree_iterator.h:169
pcl::octree::OctreeIteratorBase::reset
void reset()
Reset iterator.
Definition: octree_iterator.h:156