Point Cloud Library (PCL)  1.11.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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 <pcl/octree/octree_key.h>
43 #include <pcl/octree/octree_nodes.h>
44 
45 #include <cstddef>
46 #include <deque>
47 #include <iterator>
48 #include <vector>
49 
50 // Ignore warnings in the above headers
51 #ifdef __GNUC__
52 #pragma GCC system_header
53 #endif
54 
55 namespace pcl {
56 namespace octree {
57 
58 // Octree iterator state pushed on stack/list
59 struct IteratorState {
62  unsigned int depth_;
63 };
64 
65 /** \brief @b Abstract octree iterator class
66  * \note Octree iterator base class
67  * \ingroup octree
68  * \author Julius Kammerl (julius@kammerl.de)
69  */
70 template <typename OctreeT>
71 class OctreeIteratorBase : public std::iterator<std::forward_iterator_tag,
72  const OctreeNode,
73  void,
74  const OctreeNode*,
75  const OctreeNode&> {
76 public:
77  using LeafNode = typename OctreeT::LeafNode;
78  using BranchNode = typename OctreeT::BranchNode;
79 
80  using LeafContainer = typename OctreeT::LeafContainer;
81  using BranchContainer = typename OctreeT::BranchContainer;
82 
83  /** \brief Empty constructor.
84  */
85  explicit OctreeIteratorBase(unsigned int max_depth_arg = 0)
86  : octree_(0), current_state_(0), max_octree_depth_(max_depth_arg)
87  {
88  this->reset();
89  }
90 
91  /** \brief Constructor.
92  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
93  * root node.
94  * \param[in] max_depth_arg Depth limitation during traversal
95  */
96  explicit OctreeIteratorBase(OctreeT* octree_arg, unsigned int max_depth_arg = 0)
97  : octree_(octree_arg), current_state_(0), max_octree_depth_(max_depth_arg)
98  {
99  this->reset();
100  }
101 
102  /** \brief Constructor.
103  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
104  * root node.
105  * \param[in] max_depth_arg Depth limitation during traversal
106  * \param[in] current_state A pointer to the current iterator state
107  *
108  * \warning For advanced users only.
109  */
110  explicit OctreeIteratorBase(OctreeT* octree_arg,
111  unsigned int max_depth_arg,
112  IteratorState* current_state)
113  : octree_(octree_arg), current_state_(current_state), max_octree_depth_(max_depth_arg)
114  {}
115 
116  /** \brief Empty deconstructor. */
117  virtual ~OctreeIteratorBase() {}
118 
119  /** \brief Equal comparison operator
120  * \param[in] other OctreeIteratorBase to compare with
121  */
122  bool
123  operator==(const OctreeIteratorBase& other) const
124  {
125  if (this == &other) // same object
126  return true;
127  if (octree_ != other.octree_) // refer to different octrees
128  return false;
129  if (!current_state_ && !other.current_state_) // both are end iterators
130  return true;
132  other.current_state_ && // null dereference protection
134  return true;
135  return false;
136  }
137 
138  /** \brief Inequal comparison operator
139  * \param[in] other OctreeIteratorBase to compare with
140  */
141  bool
142  operator!=(const OctreeIteratorBase& other) const
143  {
144  return !operator==(other);
145  }
146 
147  /** \brief Reset iterator */
148  inline void
150  {
151  current_state_ = 0;
152  if (octree_ && (!max_octree_depth_)) {
153  max_octree_depth_ = octree_->getTreeDepth();
154  }
155  }
156 
157  /** \brief Get octree key for the current iterator octree node
158  * \return octree key of current node
159  */
160  inline const OctreeKey&
162  {
163  assert(octree_ != 0);
164  assert(current_state_ != 0);
165 
166  return (current_state_->key_);
167  }
168 
169  /** \brief Get the current depth level of octree
170  * \return depth level
171  */
172  inline unsigned int
174  {
175  assert(octree_ != 0);
176  assert(current_state_ != 0);
177 
178  return (current_state_->depth_);
179  }
180 
181  /** \brief Get the current octree node
182  * \return pointer to current octree node
183  */
184  inline OctreeNode*
186  {
187  assert(octree_ != 0);
188  assert(current_state_ != 0);
189 
190  return (current_state_->node_);
191  }
192 
193  /** \brief check if current node is a branch node
194  * \return true if current node is a branch node, false otherwise
195  */
196  inline bool
197  isBranchNode() const
198  {
199  assert(octree_ != 0);
200  assert(current_state_ != 0);
201 
203  }
204 
205  /** \brief check if current node is a branch node
206  * \return true if current node is a branch node, false otherwise
207  */
208  inline bool
209  isLeafNode() const
210  {
211  assert(octree_ != 0);
212  assert(current_state_ != 0);
213 
214  return (current_state_->node_->getNodeType() == LEAF_NODE);
215  }
216 
217  /** \brief *operator.
218  * \return pointer to the current octree node
219  */
220  inline OctreeNode*
221  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  */
731  OctreeNode*
732  operator*() const
733  {
734  // return designated object
735  OctreeNode* ret = 0;
736 
737  if (this->current_state_ &&
738  (this->current_state_->node_->getNodeType() == LEAF_NODE))
739  ret = this->current_state_->node_;
740  return (ret);
741  }
742 };
743 
744 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
745 /** \brief Octree leaf node iterator class
746  * \note This class implements a forward iterator for traversing the leaf nodes of an
747  * octree data structure in the breadth first way.
748  * \ingroup octree
749  * \author Fabien Rozar
750  * (fabien.rozar@gmail.com)
751  */
752 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
753 template <typename OctreeT>
757 
758 public:
759  /** \brief Empty constructor.
760  * \param[in] max_depth_arg Depth limitation during traversal
761  */
762  explicit OctreeLeafNodeBreadthFirstIterator(unsigned int max_depth_arg = 0);
763 
764  /** \brief Constructor.
765  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
766  * root node.
767  * \param[in] max_depth_arg Depth limitation during traversal
768  */
769  explicit OctreeLeafNodeBreadthFirstIterator(OctreeT* octree_arg,
770  unsigned int max_depth_arg = 0);
771 
772  /** \brief Copy constructor.
773  * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
774  * root node.
775  * \param[in] max_depth_arg Depth limitation during traversal
776  * \param[in] current_state A pointer to the current iterator state
777  * \param[in] fifo Internal container of octree node to go through
778  *
779  * \warning For advanced users only.
780  */
782  OctreeT* octree_arg,
783  unsigned int max_depth_arg,
784  IteratorState* current_state,
785  const std::deque<IteratorState>& fifo = std::deque<IteratorState>());
786 
787  /** \brief Reset the iterator to the first leaf in the breadth first way.
788  */
789  inline void
790  reset();
791 
792  /** \brief Preincrement operator.
793  * \note recursively step to next octree leaf node
794  */
796  operator++();
797 
798  /** \brief Postincrement operator.
799  * \note step to next octree node
800  */
802  operator++(int);
803 };
804 
805 } // namespace octree
806 } // namespace pcl
807 
808 /*
809  * Note: Since octree iterators depend on octrees, don't precompile them.
810  */
811 #include <pcl/octree/impl/octree_iterator.hpp>
OctreeNode * operator*() const
*operator.
OctreeBreadthFirstIterator & operator=(const OctreeBreadthFirstIterator &src)
Copy operator.
void reset()
Reset iterator.
bool operator==(const OctreeIteratorBase &other) const
Equal comparison operator.
typename OctreeIteratorBase< OctreeT >::LeafNode LeafNode
void reset()
Reset the iterator to the first node at the current depth.
OctreeNode * getCurrentOctreeNode() const
Get the current octree node.
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
typename OctreeIteratorBase< OctreeT >::BranchNode BranchNode
const BranchContainer & getBranchContainer() const
Method for retrieving the container from an octree branch node.
const LeafContainer & getLeafContainer() const
Method for retrieving a single leaf container from the octree leaf node.
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
std::deque< IteratorState > FIFO_
FIFO list.
typename OctreeIteratorBase< OctreeT >::LeafNode LeafNode
OctreeLeafNodeBreadthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg, IteratorState *current_state)
Constructor.
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.
OctreeNode * operator*() const
*operator.
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.
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.
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
virtual unsigned long getNodeID() const
get a integer identifier for current node (note: identifier depends on tree depth).
OctreeIteratorBase(unsigned int max_depth_arg=0)
Empty constructor.
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.
OctreeDepthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
bool isLeafNode() const
check if current node is a branch 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.
void skipChildVoxels()
Skip all child voxels of current node and return to parent node.
void reset()
Reset the iterator to the first leaf in the breadth first way.
typename OctreeT::BranchContainer BranchContainer
Octree key class
Definition: octree_key.h:52
unsigned int getCurrentOctreeDepth() const
Get the current depth level of octree.
OctreeDepthFirstIterator(const OctreeDepthFirstIterator &other)
Copy Constructor.
OctreeBreadthFirstIterator & operator++()
Preincrement operator.
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.
char getNodeConfiguration() const
Get bit pattern of children configuration of current node.
virtual ~OctreeIteratorBase()
Empty deconstructor.
bool operator!=(const OctreeIteratorBase &other) const
Inequal comparison operator.
OctreeLeafNodeDepthFirstIterator(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
OctreeLeafNodeBreadthFirstIterator & operator++()
Preincrement operator.
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:61
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
OctreeLeafNodeDepthFirstIterator operator++(int)
postincrement operator.
bool isBranchNode() const
check if current node is a branch node
BranchContainer & getBranchContainer()
Method for retrieving the container from an octree branch node.
OctreeBreadthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.