octomap 1.9.8
Loading...
Searching...
No Matches
leaf_bbx_iterator Class Reference

Bounding-box leaf iterator. More...

#include <OcTreeIterator.hxx>

Inheritance diagram for leaf_bbx_iterator:
Collaboration diagram for leaf_bbx_iterator:

Public Member Functions

point3d getCoordinate () const
 return the center coordinate of the current node
unsigned getDepth () const
 return depth of the current node
OcTreeKey getIndexKey () const
const OcTreeKey & getKey () const
double getSize () const
double getX () const
double getY () const
double getZ () const
 leaf_bbx_iterator ()
 leaf_bbx_iterator (const leaf_bbx_iterator &other)
 leaf_bbx_iterator (OcTreeBaseImpl< NodeType, INTERFACE > const *ptree, const OcTreeKey &min, const OcTreeKey &max, uint8_t depth=0)
 Constructor of the iterator.
 leaf_bbx_iterator (OcTreeBaseImpl< NodeType, INTERFACE > const *ptree, const point3d &min, const point3d &max, uint8_t depth=0)
 Constructor of the iterator.
bool operator!= (const iterator_base &other) const
 Comparison between iterators. First compares the tree, then stack size and top element of stack.
NodeType & operator* ()
 Return the current node in the octree which the iterator is referring to.
const NodeType & operator* () const
 Return the current node in the octree which the iterator is referring to.
leaf_bbx_iteratoroperator++ ()
 prefix increment operator of iterator (++it)
leaf_bbx_iterator operator++ (int)
 postfix increment operator of iterator (it++)
NodeType * operator-> ()
 Ptr operator will return the current node in the octree which the iterator is referring to.
NodeType const * operator-> () const
 Ptr operator will return the current node in the octree which the iterator is referring to.
bool operator== (const iterator_base &other) const
 Comparison between iterators. First compares the tree, then stack size and top element of stack.

Data Fields

OcTreeKey elements
 STL member.

Protected Member Functions

void singleIncrement ()

Protected Attributes

uint8_t maxDepth
 Maximum depth for depth-limited queries.
OcTreeKey maxKey
OcTreeKey minKey
std::stack< StackElement, std::vector< StackElement > > stack
 Internal recursion stack. Apparently a stack of vector works fastest here.
OcTreeBaseImpl< NodeType, INTERFACE > const * tree
 Octree this iterator is working on.

Detailed Description

Bounding-box leaf iterator.

This iterator will traverse all leaf nodes within a given bounding box (axis-aligned). See below for example usage. Note that the non-trivial call to tree->end_leafs_bbx() should be done only once for efficiency!

for(OcTreeTYPE::leaf_bbx_iterator it = tree->begin_leafs_bbx(min,max),
end=tree->end_leafs_bbx(); it!= end; ++it)
{
//manipulate node, e.g.:
std::cout << "Node center: " << it.getCoordinate() << std::endl;
std::cout << "Node size: " << it.getSize() << std::endl;
std::cout << "Node value: " << it->getValue() << std::endl;
}
OcTreeBaseImpl< NodeType, INTERFACE > const * tree
Octree this iterator is working on.
Definition OcTreeIterator.hxx:158

Constructor & Destructor Documentation

◆ leaf_bbx_iterator() [1/4]

leaf_bbx_iterator::leaf_bbx_iterator ( )
inline

◆ leaf_bbx_iterator() [2/4]

leaf_bbx_iterator::leaf_bbx_iterator ( OcTreeBaseImpl< NodeType, INTERFACE > const * ptree,
const point3d & min,
const point3d & max,
uint8_t depth = 0 )
inline

Constructor of the iterator.

The bounding box corners min and max are converted into an OcTreeKey first.

Note
Due to rounding and discretization effects, nodes may be traversed that have float coordinates appearing outside of the (float) bounding box. However, the node's complete volume will include the bounding box coordinate. For a more exact control, use the constructor with OcTreeKeys instead.
Parameters
ptreeOcTreeBaseImpl on which the iterator is used on
minMinimum point3d of the axis-aligned boundingbox
maxMaximum point3d of the axis-aligned boundingbox
depthMaximum depth to traverse the tree. 0 (default): unlimited

References iterator_base::iterator_base(), and iterator_base::stack.

◆ leaf_bbx_iterator() [3/4]

leaf_bbx_iterator::leaf_bbx_iterator ( OcTreeBaseImpl< NodeType, INTERFACE > const * ptree,
const OcTreeKey & min,
const OcTreeKey & max,
uint8_t depth = 0 )
inline

Constructor of the iterator.

This version uses the exact keys as axis-aligned bounding box (including min and max).

Parameters
ptreeOcTreeBaseImpl on which the iterator is used on
minMinimum OcTreeKey to be included in the axis-aligned boundingbox
maxMaximum OcTreeKey to be included in the axis-aligned boundingbox
depthMaximum depth to traverse the tree. 0 (default): unlimited

References iterator_base::iterator_base(), maxKey, minKey, and iterator_base::stack.

◆ leaf_bbx_iterator() [4/4]

leaf_bbx_iterator::leaf_bbx_iterator ( const leaf_bbx_iterator & other)
inline

Member Function Documentation

◆ getCoordinate()

point3d iterator_base::getCoordinate ( ) const
inlineinherited

return the center coordinate of the current node

References stack, and tree.

◆ getDepth()

unsigned iterator_base::getDepth ( ) const
inlineinherited

return depth of the current node

References stack.

◆ getIndexKey()

OcTreeKey iterator_base::getIndexKey ( ) const
inlineinherited
Returns
the OcTreeKey of the current node, for nodes with depth != maxDepth

References stack, and tree.

◆ getKey()

const OcTreeKey & iterator_base::getKey ( ) const
inlineinherited
Returns
the OcTreeKey of the current node

References stack.

◆ getSize()

double iterator_base::getSize ( ) const
inlineinherited
Returns
the side of the volume occupied by the current node

References stack, and tree.

◆ getX()

double iterator_base::getX ( ) const
inlineinherited
Returns
single coordinate of the current node

References stack, and tree.

◆ getY()

double iterator_base::getY ( ) const
inlineinherited
Returns
single coordinate of the current node

References stack, and tree.

◆ getZ()

double iterator_base::getZ ( ) const
inlineinherited
Returns
single coordinate of the current node

References stack, and tree.

◆ operator!=()

bool iterator_base::operator!= ( const iterator_base & other) const
inlineinherited

Comparison between iterators. First compares the tree, then stack size and top element of stack.

References iterator_base(), stack, and tree.

◆ operator*() [1/2]

NodeType & iterator_base::operator* ( )
inlineinherited

Return the current node in the octree which the iterator is referring to.

References stack.

◆ operator*() [2/2]

const NodeType & iterator_base::operator* ( ) const
inlineinherited

Return the current node in the octree which the iterator is referring to.

References stack.

◆ operator++() [1/2]

leaf_bbx_iterator & leaf_bbx_iterator::operator++ ( )
inline

prefix increment operator of iterator (++it)

References leaf_bbx_iterator(), singleIncrement(), iterator_base::stack, and iterator_base::tree.

◆ operator++() [2/2]

leaf_bbx_iterator leaf_bbx_iterator::operator++ ( int )
inline

postfix increment operator of iterator (it++)

References leaf_bbx_iterator().

◆ operator->() [1/2]

NodeType * iterator_base::operator-> ( )
inlineinherited

Ptr operator will return the current node in the octree which the iterator is referring to.

References stack.

◆ operator->() [2/2]

NodeType const * iterator_base::operator-> ( ) const
inlineinherited

Ptr operator will return the current node in the octree which the iterator is referring to.

References stack.

◆ operator==()

bool iterator_base::operator== ( const iterator_base & other) const
inlineinherited

Comparison between iterators. First compares the tree, then stack size and top element of stack.

References iterator_base(), stack, and tree.

◆ singleIncrement()

Field Documentation

◆ elements

OcTreeKey std::vector< OcTreeKey >::elements
inherited

STL member.

◆ maxDepth

uint8_t iterator_base::maxDepth
protectedinherited

Maximum depth for depth-limited queries.

Referenced by iterator_base(), iterator_base(), iterator_base(), operator=(), and singleIncrement().

◆ maxKey

OcTreeKey leaf_bbx_iterator::maxKey
protected

◆ minKey

OcTreeKey leaf_bbx_iterator::minKey
protected

◆ stack

◆ tree


The documentation for this class was generated from the following file: