-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of the iterator 'OctreeFixedDepthIterator'. #1983
Changes from all commits
ba61cf5
8353b0c
76914e9
2996db6
b165f31
15cf4b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2010-2012, Willow Garage, Inc. | ||
* Copyright (c) 2017-, Open Perception, Inc. | ||
* | ||
* All rights reserved. | ||
* | ||
|
@@ -62,7 +63,7 @@ namespace pcl | |
struct IteratorState{ | ||
OctreeNode* node_; | ||
OctreeKey key_; | ||
unsigned char depth_; | ||
unsigned int depth_; | ||
}; | ||
|
||
|
||
|
@@ -474,12 +475,11 @@ namespace pcl | |
template<typename OctreeT> | ||
class OctreeBreadthFirstIterator : public OctreeIteratorBase<OctreeT> | ||
{ | ||
public: | ||
// public typedefs | ||
typedef typename OctreeIteratorBase<OctreeT>::BranchNode BranchNode; | ||
typedef typename OctreeIteratorBase<OctreeT>::LeafNode LeafNode; | ||
|
||
|
||
public: | ||
/** \brief Empty constructor. | ||
* \param[in] max_depth_arg Depth limitation during traversal | ||
*/ | ||
|
@@ -568,6 +568,92 @@ namespace pcl | |
std::deque<IteratorState> FIFO_; | ||
}; | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/** \brief @b Octree iterator class | ||
* \note Iterator over all existing nodes at a given depth. It walks across an octree | ||
* in a breadth-first manner. | ||
* \ingroup octree | ||
* \author Fabien Rozar (fabien.rozar@gmail.com) | ||
*/ | ||
template<typename OctreeT> | ||
class OctreeFixedDepthIterator : public OctreeBreadthFirstIterator<OctreeT> | ||
{ | ||
public: | ||
|
||
// public typedefs | ||
using typename OctreeBreadthFirstIterator<OctreeT>::BranchNode; | ||
using typename OctreeBreadthFirstIterator<OctreeT>::LeafNode; | ||
|
||
/** \brief Empty constructor. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no parameter. Also, "emtpy constructor" is not very helpful. We should rather say that the constructed iterator is not valid. Finally, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The empty ctor call The |
||
*/ | ||
OctreeFixedDepthIterator (); | ||
|
||
/** \brief Constructor. | ||
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node. | ||
* \param[in] fixed_depth_arg Depth level during traversal | ||
*/ | ||
explicit | ||
OctreeFixedDepthIterator (OctreeT* octree_arg, unsigned int fixed_depth_arg = 0); | ||
|
||
/** \brief Constructor. | ||
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its root node. | ||
* \param[in] fixed_depth_arg Depth level during traversal | ||
* \param[in] current_state A pointer to the current iterator state | ||
* \param[in] fifo Internal container of octree node to go through | ||
* | ||
* \warning For advanced users only. | ||
*/ | ||
OctreeFixedDepthIterator (OctreeT* octree_arg, | ||
unsigned int fixed_depth_arg, | ||
IteratorState* current_state, | ||
const std::deque<IteratorState>& fifo = std::deque<IteratorState> ()) | ||
: OctreeBreadthFirstIterator<OctreeT> (octree_arg, fixed_depth_arg, current_state, fifo) | ||
, fixed_depth_ (fixed_depth_arg) | ||
{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried to delete it, but surprisingly this constructor is used: To instantiate the end state, we need it... Moreover, these constructors (which deal with internal container) must remain in the public scope. |
||
|
||
/** \brief Copy Constructor. | ||
* \param[in] other Another OctreeFixedDepthIterator to copy from | ||
*/ | ||
OctreeFixedDepthIterator (const OctreeFixedDepthIterator& other) | ||
: OctreeBreadthFirstIterator<OctreeT> (other) | ||
{ | ||
this->fixed_depth_ = other.fixed_depth_; | ||
} | ||
|
||
/** \brief Copy assignment. | ||
* \param[in] src the iterator to copy into this | ||
* \return pointer to the current octree node | ||
*/ | ||
inline OctreeFixedDepthIterator& | ||
operator = (const OctreeFixedDepthIterator& src) | ||
{ | ||
OctreeBreadthFirstIterator<OctreeT>::operator= (src); | ||
this->fixed_depth_ = src.fixed_depth_; | ||
|
||
return (*this); | ||
} | ||
|
||
/** \brief Reset the iterator to the first node at the depth given as parameter | ||
* \param[in] fixed_depth_arg Depth level during traversal | ||
*/ | ||
void | ||
reset (unsigned int fixed_depth_arg); | ||
|
||
/** \brief Reset the iterator to the first node at the current depth | ||
*/ | ||
void | ||
reset () | ||
{ | ||
this->reset (fixed_depth_); | ||
} | ||
|
||
protected: | ||
using OctreeBreadthFirstIterator<OctreeT>::FIFO_; | ||
|
||
/** \brief Given level of the node to be iterated */ | ||
unsigned int fixed_depth_; | ||
}; | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/** \brief Octree leaf node iterator class | ||
* \note This class implements a forward iterator for traversing the leaf nodes of an octree data structure. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it makes more sense to start this from 2012/2013 onwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a question for @taketwo. I don't have any opinion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think copyright should be claimed for the years when no changes have been introduced.