Main MRPT website > C++ reference for MRPT 1.3.2
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
octomap::OcTreeBaseImpl< NODE, INTERFACE > Class Template Reference

Detailed Description

template<class NODE, class INTERFACE>
class octomap::OcTreeBaseImpl< NODE, INTERFACE >

OcTree base class, to be used with with any kind of OcTreeDataNode.

This tree implementation currently has a maximum depth of 16 nodes. For this reason, coordinates values have to be, e.g., below +/- 327.68 meters (2^15) at a maximum resolution of 0.01m.

This limitation enables the use of an efficient key generation method which uses the binary representation of the data point coordinates.

Note
You should probably not use this class directly, but OcTreeBase or OccupancyOcTreeBase instead
Template Parameters
NODENode class to be used in tree (usually derived from OcTreeDataNode)
INTERFACEInterface to be derived from, should be either AbstractOcTree or AbstractOccupancyOcTree

Definition at line 85 of file OcTreeBaseImpl.h.

#include <mrpt/otherlibs/octomap/OcTreeBaseImpl.h>

Inheritance diagram for octomap::OcTreeBaseImpl< NODE, INTERFACE >:
Inheritance graph

Classes

class  iterator_base
 Base class for OcTree iterators. More...
 
class  leaf_bbx_iterator
 Bounding-box leaf iterator. More...
 
class  leaf_iterator
 Iterator to iterate over all leafs of the tree. More...
 
class  tree_iterator
 Iterator over the complete tree (inner nodes and leafs). More...
 

Public Types

typedef NODE NodeType
 Make the templated NODE type available from the outside. More...
 
typedef leaf_iterator iterator
 

Public Member Functions

 OcTreeBaseImpl (double resolution)
 
virtual ~OcTreeBaseImpl ()
 
 OcTreeBaseImpl (const OcTreeBaseImpl< NODE, INTERFACE > &rhs)
 
bool operator== (const OcTreeBaseImpl< NODE, INTERFACE > &rhs) const
 
std::string getTreeType () const
 
void setResolution (double r)
 Change the resolution of the octree, scaling all voxels. More...
 
double getResolution () const
 
unsigned int getTreeDepth () const
 
double getNodeSize (unsigned depth) const
 
NODE * getRoot () const
 
NODE * search (double x, double y, double z, unsigned int depth=0) const
 Search node at specified depth given a 3d point (depth=0: search full tree depth) More...
 
NODE * search (const point3d &value, unsigned int depth=0) const
 Search node at specified depth given a 3d point (depth=0: search full tree depth) More...
 
NODE * search (const OcTreeKey &key, unsigned int depth=0) const
 Search a node at specified depth given an addressing key (depth=0: search full tree depth) More...
 
bool deleteNode (double x, double y, double z, unsigned int depth=0)
 Delete a node (if exists) given a 3d point. More...
 
bool deleteNode (const point3d &value, unsigned int depth=0)
 Delete a node (if exists) given a 3d point. More...
 
bool deleteNode (const OcTreeKey &key, unsigned int depth=0)
 Delete a node (if exists) given an addressing key. More...
 
void clear ()
 Deletes the complete tree structure (only the root node will remain) More...
 
virtual void prune ()
 Lossless compression of OcTree: merge children to parent when there are eight children with identical values. More...
 
virtual void expand ()
 Expands all pruned nodes (reverse of prune()) More...
 
virtual size_t size () const
 
virtual size_t memoryUsage () const
 
virtual size_t memoryUsageNode () const
 
size_t memoryFullGrid () const
 
double volume () const
 
virtual void getMetricSize (double &x, double &y, double &z)
 Size of OcTree (all known space) in meters for x, y and z dimension. More...
 
virtual void getMetricSize (double &x, double &y, double &z) const
 Size of OcTree (all known space) in meters for x, y and z dimension. More...
 
virtual void getMetricMin (double &x, double &y, double &z)
 minimum value of the bounding box of all known space in x, y, z More...
 
void getMetricMin (double &x, double &y, double &z) const
 minimum value of the bounding box of all known space in x, y, z More...
 
virtual void getMetricMax (double &x, double &y, double &z)
 maximum value of the bounding box of all known space in x, y, z More...
 
void getMetricMax (double &x, double &y, double &z) const
 maximum value of the bounding box of all known space in x, y, z More...
 
size_t calcNumNodes () const
 Traverses the tree to calculate the total number of nodes. More...
 
size_t getNumLeafNodes () const
 Traverses the tree to calculate the total number of leaf nodes. More...
 
void getUnknownLeafCenters (point3d_list &node_centers, point3d pmin, point3d pmax) const
 return centers of leafs that do NOT exist (but could) in a given bounding box More...
 
bool computeRayKeys (const point3d &origin, const point3d &end, KeyRay &ray) const
 Traces a ray from origin to end (excluding), returning an OcTreeKey of all nodes traversed by the beam. More...
 
bool computeRay (const point3d &origin, const point3d &end, std::vector< point3d > &ray)
 Traces a ray from origin to end (excluding), returning the coordinates of all nodes traversed by the beam. More...
 
std::istream & readData (std::istream &s)
 Read all nodes from the input stream (without file header), for this the tree needs to be already created. More...
 
std::ostream & writeData (std::ostream &s) const
 Write complete state of tree to stream (without file header) unmodified. More...
 
iterator begin (unsigned char maxDepth=0) const
 
const iterator end () const
 
leaf_iterator begin_leafs (unsigned char maxDepth=0) const
 
const leaf_iterator end_leafs () const
 
leaf_bbx_iterator begin_leafs_bbx (const OcTreeKey &min, const OcTreeKey &max, unsigned char maxDepth=0) const
 
leaf_bbx_iterator begin_leafs_bbx (const point3d &min, const point3d &max, unsigned char maxDepth=0) const
 
const leaf_bbx_iterator end_leafs_bbx () const
 
tree_iterator begin_tree (unsigned char maxDepth=0) const
 
const tree_iterator end_tree () const
 
unsigned short int coordToKey (double coordinate) const
 Converts from a single coordinate into a discrete key. More...
 
unsigned short int coordToKey (double coordinate, unsigned depth) const
 Converts from a single coordinate into a discrete key at a given depth. More...
 
OcTreeKey coordToKey (const point3d &coord) const
 Converts from a 3D coordinate into a 3D addressing key. More...
 
OcTreeKey coordToKey (double x, double y, double z) const
 Converts from a 3D coordinate into a 3D addressing key. More...
 
OcTreeKey coordToKey (const point3d &coord, unsigned depth) const
 Converts from a 3D coordinate into a 3D addressing key at a given depth. More...
 
OcTreeKey coordToKey (double x, double y, double z, unsigned depth) const
 Converts from a 3D coordinate into a 3D addressing key at a given depth. More...
 
OcTreeKey adjustKeyAtDepth (const OcTreeKey &key, unsigned int depth) const
 Adjusts a 3D key from the lowest level to correspond to a higher depth (by shifting the key values) More...
 
unsigned short int adjustKeyAtDepth (unsigned short int key, unsigned int depth) const
 Adjusts a single key value from the lowest level to correspond to a higher depth (by shifting the key value) More...
 
bool coordToKeyChecked (const point3d &coord, OcTreeKey &key) const
 Converts a 3D coordinate into a 3D OcTreeKey, with boundary checking. More...
 
bool coordToKeyChecked (const point3d &coord, unsigned depth, OcTreeKey &key) const
 Converts a 3D coordinate into a 3D OcTreeKey at a certain depth, with boundary checking. More...
 
bool coordToKeyChecked (double x, double y, double z, OcTreeKey &key) const
 Converts a 3D coordinate into a 3D OcTreeKey, with boundary checking. More...
 
bool coordToKeyChecked (double x, double y, double z, unsigned depth, OcTreeKey &key) const
 Converts a 3D coordinate into a 3D OcTreeKey at a certain depth, with boundary checking. More...
 
bool coordToKeyChecked (double coordinate, unsigned short int &key) const
 Converts a single coordinate into a discrete addressing key, with boundary checking. More...
 
bool coordToKeyChecked (double coordinate, unsigned depth, unsigned short int &key) const
 Converts a single coordinate into a discrete addressing key, with boundary checking. More...
 
double keyToCoord (unsigned short int key, unsigned depth) const
 converts from a discrete key at a given depth into a coordinate corresponding to the key's center More...
 
double keyToCoord (unsigned short int key) const
 converts from a discrete key at the lowest tree level into a coordinate corresponding to the key's center More...
 
point3d keyToCoord (const OcTreeKey &key) const
 converts from an addressing key at the lowest tree level into a coordinate corresponding to the key's center More...
 
point3d keyToCoord (const OcTreeKey &key, unsigned depth) const
 converts from an addressing key at a given depth into a coordinate corresponding to the key's center More...
 
 DEPRECATED (bool genKeyValue(double coordinate, unsigned short int &keyval) const)
 
 DEPRECATED (bool genKey(const point3d &point, OcTreeKey &key) const )
 
 DEPRECATED (bool genKeyValueAtDepth(const unsigned short int keyval, unsigned int depth, unsigned short int &out_keyval) const )
 
 DEPRECATED (bool genKeyAtDepth(const OcTreeKey &key, unsigned int depth, OcTreeKey &out_key) const )
 
 DEPRECATED (bool genCoordFromKey(const unsigned short int &key, unsigned depth, float &coord) const )
 
 DEPRECATED (inline bool genCoordFromKey(const unsigned short int &key, float &coord, unsigned depth) const)
 
 DEPRECATED (inline bool genCoordFromKey(const unsigned short int &key, float &coord) const)
 
 DEPRECATED (double genCoordFromKey(const unsigned short int &key, unsigned depth) const)
 
 DEPRECATED (inline double genCoordFromKey(const unsigned short int &key) const)
 
 DEPRECATED (inline bool genCoords(const OcTreeKey &key, unsigned int depth, point3d &point) const)
 
 DEPRECATED (inline void genPos(const OcTreeKey &key, int depth, unsigned int &pos) const)
 generate child index (between 0 and 7) from key at given tree depth DEPRECATED More...
 

Protected Member Functions

 OcTreeBaseImpl (double resolution, unsigned int tree_depth, unsigned int tree_max_val)
 Constructor to enable derived classes to change tree constants. More...
 
void calcMinMax ()
 recalculates min and max in x, y, z. Does nothing when tree size didn't change. More...
 
void calcNumNodesRecurs (NODE *node, size_t &num_nodes) const
 
bool deleteNodeRecurs (NODE *node, unsigned int depth, unsigned int max_depth, const OcTreeKey &key)
 recursive call of deleteNode() More...
 
void pruneRecurs (NODE *node, unsigned int depth, unsigned int max_depth, unsigned int &num_pruned)
 recursive call of prune() More...
 
void expandRecurs (NODE *node, unsigned int depth, unsigned int max_depth)
 recursive call of expand() More...
 
size_t getNumLeafNodesRecurs (const NODE *parent) const
 

Protected Attributes

NODE * root
 
const unsigned int tree_depth
 Maximum tree depth is fixed to 16 currently. More...
 
const unsigned int tree_max_val
 
double resolution
 in meters More...
 
double resolution_factor
 = 1. / resolution More...
 
size_t tree_size
 number of nodes in tree More...
 
bool size_changed
 flag to denote whether the octree extent changed (for lazy min/max eval) More...
 
point3d tree_center
 
double max_value [3]
 max in x, y, z More...
 
double min_value [3]
 min in x, y, z More...
 
std::vector< double > sizeLookupTable
 contains the size of a voxel at level i (0: root node). tree_depth+1 levels (incl. 0) More...
 
KeyRay keyray
 
const leaf_iterator leaf_iterator_end
 
const leaf_bbx_iterator leaf_iterator_bbx_end
 
const tree_iterator tree_iterator_end
 

Private Member Functions

OcTreeBaseImpl< NODE, INTERFACE > & operator= (const OcTreeBaseImpl< NODE, INTERFACE > &)
 Assignment operator is private: don't (re-)assign octrees (const-parameters can't be changed) - use the copy constructor instead. More...
 

Member Typedef Documentation

template<class NODE, class INTERFACE>
typedef leaf_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::iterator

Definition at line 261 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
typedef NODE octomap::OcTreeBaseImpl< NODE, INTERFACE >::NodeType

Make the templated NODE type available from the outside.

Definition at line 89 of file OcTreeBaseImpl.h.

Constructor & Destructor Documentation

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::OcTreeBaseImpl ( double  resolution)
template<class NODE, class INTERFACE>
virtual octomap::OcTreeBaseImpl< NODE, INTERFACE >::~OcTreeBaseImpl ( )
virtual
template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::OcTreeBaseImpl ( const OcTreeBaseImpl< NODE, INTERFACE > &  rhs)
template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::OcTreeBaseImpl ( double  resolution,
unsigned int  tree_depth,
unsigned int  tree_max_val 
)
protected

Constructor to enable derived classes to change tree constants.

This usually requires a re-implementation of some core tree-traversal functions as well!

Member Function Documentation

template<class NODE, class INTERFACE>
OcTreeKey octomap::OcTreeBaseImpl< NODE, INTERFACE >::adjustKeyAtDepth ( const OcTreeKey key,
unsigned int  depth 
) const
inline

Adjusts a 3D key from the lowest level to correspond to a higher depth (by shifting the key values)

Parameters
keyInput key, at the lowest tree level
depthTarget depth level for the new key
Returns
Key for the new depth level

Definition at line 336 of file OcTreeBaseImpl.h.

Referenced by octomap::OcTreeBaseImpl< OcTreeNodeStamped, AbstractOccupancyOcTree >::adjustKeyAtDepth().

template<class NODE, class INTERFACE>
unsigned short int octomap::OcTreeBaseImpl< NODE, INTERFACE >::adjustKeyAtDepth ( unsigned short int  key,
unsigned int  depth 
) const

Adjusts a single key value from the lowest level to correspond to a higher depth (by shifting the key value)

Parameters
keyInput key, at the lowest tree level
depthTarget depth level for the new key
Returns
Key for the new depth level
template<class NODE, class INTERFACE>
iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::begin ( unsigned char  maxDepth = 0) const
inline
Returns
beginning of the tree as leaf iterator

Definition at line 264 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
leaf_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::begin_leafs ( unsigned char  maxDepth = 0) const
inline
Returns
beginning of the tree as leaf iterator

Definition at line 269 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
leaf_bbx_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::begin_leafs_bbx ( const OcTreeKey min,
const OcTreeKey max,
unsigned char  maxDepth = 0 
) const
inline
Returns
beginning of the tree as leaf iterator in a bounding box

Definition at line 274 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
leaf_bbx_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::begin_leafs_bbx ( const point3d min,
const point3d max,
unsigned char  maxDepth = 0 
) const
inline
Returns
beginning of the tree as leaf iterator in a bounding box

Definition at line 278 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
tree_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::begin_tree ( unsigned char  maxDepth = 0) const
inline
Returns
beginning of the tree as iterator to all nodes (incl. inner)

Definition at line 285 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::calcMinMax ( )
protected

recalculates min and max in x, y, z. Does nothing when tree size didn't change.

template<class NODE, class INTERFACE>
size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::calcNumNodes ( ) const

Traverses the tree to calculate the total number of nodes.

template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::calcNumNodesRecurs ( NODE *  node,
size_t &  num_nodes 
) const
protected
template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::clear ( )

Deletes the complete tree structure (only the root node will remain)

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::computeRay ( const point3d origin,
const point3d end,
std::vector< point3d > &  ray 
)

Traces a ray from origin to end (excluding), returning the coordinates of all nodes traversed by the beam.

You still need to check if a node at that coordinate exists (e.g. with search()).

Note
: use the faster computeRayKeys method if possible.
Parameters
originstart coordinate of ray
endend coordinate of ray
rayKeyRay structure that holds the keys of all nodes traversed by the ray, excluding "end"
Returns
Success of operation. Returning false usually means that one of the coordinates is out of the OcTree's range
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::computeRayKeys ( const point3d origin,
const point3d end,
KeyRay ray 
) const

Traces a ray from origin to end (excluding), returning an OcTreeKey of all nodes traversed by the beam.

You still need to check if a node at that coordinate exists (e.g. with search()).

Parameters
originstart coordinate of ray
endend coordinate of ray
rayKeyRay structure that holds the keys of all nodes traversed by the ray, excluding "end"
Returns
Success of operation. Returning false usually means that one of the coordinates is out of the OcTree's range
template<class NODE, class INTERFACE>
unsigned short int octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKey ( double  coordinate) const
inline

Converts from a single coordinate into a discrete key.

Definition at line 294 of file OcTreeBaseImpl.h.

Referenced by octomap::OcTreeBaseImpl< OcTreeNodeStamped, AbstractOccupancyOcTree >::coordToKey().

template<class NODE, class INTERFACE>
unsigned short int octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKey ( double  coordinate,
unsigned  depth 
) const

Converts from a single coordinate into a discrete key at a given depth.

template<class NODE, class INTERFACE>
OcTreeKey octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKey ( const point3d coord) const
inline

Converts from a 3D coordinate into a 3D addressing key.

Definition at line 303 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
OcTreeKey octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKey ( double  x,
double  y,
double  z 
) const
inline

Converts from a 3D coordinate into a 3D addressing key.

Definition at line 308 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
OcTreeKey octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKey ( const point3d coord,
unsigned  depth 
) const
inline

Converts from a 3D coordinate into a 3D addressing key at a given depth.

Definition at line 313 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
OcTreeKey octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKey ( double  x,
double  y,
double  z,
unsigned  depth 
) const
inline

Converts from a 3D coordinate into a 3D addressing key at a given depth.

Definition at line 321 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKeyChecked ( const point3d coord,
OcTreeKey key 
) const

Converts a 3D coordinate into a 3D OcTreeKey, with boundary checking.

Parameters
coord3d coordinate of a point
keyvalues that will be computed, an array of fixed size 3.
Returns
true if point is within the octree (valid), false otherwise

Referenced by octomap::OcTreeBaseImpl< OcTreeNodeStamped, AbstractOccupancyOcTree >::DEPRECATED().

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKeyChecked ( const point3d coord,
unsigned  depth,
OcTreeKey key 
) const

Converts a 3D coordinate into a 3D OcTreeKey at a certain depth, with boundary checking.

Parameters
coord3d coordinate of a point
depthlevel of the key from the top
keyvalues that will be computed, an array of fixed size 3.
Returns
true if point is within the octree (valid), false otherwise
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKeyChecked ( double  x,
double  y,
double  z,
OcTreeKey key 
) const

Converts a 3D coordinate into a 3D OcTreeKey, with boundary checking.

Parameters
x
y
z
keyvalues that will be computed, an array of fixed size 3.
Returns
true if point is within the octree (valid), false otherwise
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKeyChecked ( double  x,
double  y,
double  z,
unsigned  depth,
OcTreeKey key 
) const

Converts a 3D coordinate into a 3D OcTreeKey at a certain depth, with boundary checking.

Parameters
x
y
z
depthlevel of the key from the top
keyvalues that will be computed, an array of fixed size 3.
Returns
true if point is within the octree (valid), false otherwise
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKeyChecked ( double  coordinate,
unsigned short int &  key 
) const

Converts a single coordinate into a discrete addressing key, with boundary checking.

Parameters
coordinate3d coordinate of a point
keydiscrete 16 bit adressing key, result
Returns
true if coordinate is within the octree bounds (valid), false otherwise
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::coordToKeyChecked ( double  coordinate,
unsigned  depth,
unsigned short int &  key 
) const

Converts a single coordinate into a discrete addressing key, with boundary checking.

Parameters
coordinate3d coordinate of a point
depthlevel of the key from the top
keydiscrete 16 bit adressing key, result
Returns
true if coordinate is within the octree bounds (valid), false otherwise
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::deleteNode ( double  x,
double  y,
double  z,
unsigned int  depth = 0 
)

Delete a node (if exists) given a 3d point.

Will always delete at the lowest level unless depth !=0, and expand pruned inner nodes as needed. Pruned nodes at level "depth" will directly be deleted as a whole.

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::deleteNode ( const point3d value,
unsigned int  depth = 0 
)

Delete a node (if exists) given a 3d point.

Will always delete at the lowest level unless depth !=0, and expand pruned inner nodes as needed. Pruned nodes at level "depth" will directly be deleted as a whole.

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::deleteNode ( const OcTreeKey key,
unsigned int  depth = 0 
)

Delete a node (if exists) given an addressing key.

Will always delete at the lowest level unless depth !=0, and expand pruned inner nodes as needed. Pruned nodes at level "depth" will directly be deleted as a whole.

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::deleteNodeRecurs ( NODE *  node,
unsigned int  depth,
unsigned int  max_depth,
const OcTreeKey key 
)
protected

recursive call of deleteNode()

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( bool genKeyValue(double coordinate, unsigned short int &keyval)  const)
inline
Deprecated:
, replaced with coordToKeyChecked()

Definition at line 438 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( bool genKey(const point3d &point, OcTreeKey &key)  const)
inline
Deprecated:
, replaced with coordToKeyChecked()

Definition at line 443 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( bool genKeyValueAtDepth(const unsigned short int keyval, unsigned int depth, unsigned short int &out_keyval)  const)
Deprecated:
, replaced by adjustKeyAtDepth() or coordToKey() with depth parameter
template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( bool genKeyAtDepth(const OcTreeKey &key, unsigned int depth, OcTreeKey &out_key)  const)
Deprecated:
, replaced by adjustKeyAtDepth() or coordToKey() with depth parameter
template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( bool genCoordFromKey(const unsigned short int &key, unsigned depth, float &coord)  const)
inline
Deprecated:
, replaced by keyToCoord() Will always return true, there is no more boundary check here

Definition at line 455 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( inline bool genCoordFromKey(const unsigned short int &key, float &coord, unsigned depth)  const)
inline
Deprecated:
, replaced by keyToCoord() Will always return true, there is no more boundary check here

Definition at line 462 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( inline bool genCoordFromKey(const unsigned short int &key, float &coord)  const)
inline
Deprecated:
, replaced by keyToCoord() Will always return true, there is no more boundary check here

Definition at line 469 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( double genCoordFromKey(const unsigned short int &key, unsigned depth)  const)
inline
Deprecated:
, replaced by keyToCoord()

Definition at line 475 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( inline double genCoordFromKey(const unsigned short int &key)  const)
inline
Deprecated:
, replaced by keyToCoord()

Definition at line 480 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( inline bool genCoords(const OcTreeKey &key, unsigned int depth, point3d &point)  const)
inline
Deprecated:
, replaced by keyToCoord(). Will always return true, there is no more boundary check here

Definition at line 486 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
octomap::OcTreeBaseImpl< NODE, INTERFACE >::DEPRECATED ( inline void genPos(const OcTreeKey &key, int depth, unsigned int &pos)  const)
inline

generate child index (between 0 and 7) from key at given tree depth DEPRECATED

Definition at line 493 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
const iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::end ( ) const
inline
Returns
end of the tree as leaf iterator

Definition at line 266 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
const leaf_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::end_leafs ( ) const
inline
Returns
end of the tree as leaf iterator

Definition at line 271 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
const leaf_bbx_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::end_leafs_bbx ( ) const
inline
Returns
end of the tree as leaf iterator in a bounding box

Definition at line 282 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
const tree_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::end_tree ( ) const
inline
Returns
end of the tree as iterator to all nodes (incl. inner)

Definition at line 287 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
virtual void octomap::OcTreeBaseImpl< NODE, INTERFACE >::expand ( )
virtual

Expands all pruned nodes (reverse of prune())

Note
This is an expensive operation, especially when the tree is nearly empty!
template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::expandRecurs ( NODE *  node,
unsigned int  depth,
unsigned int  max_depth 
)
protected

recursive call of expand()

template<class NODE, class INTERFACE>
virtual void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getMetricMax ( double &  x,
double &  y,
double &  z 
)
virtual

maximum value of the bounding box of all known space in x, y, z

template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getMetricMax ( double &  x,
double &  y,
double &  z 
) const

maximum value of the bounding box of all known space in x, y, z

template<class NODE, class INTERFACE>
virtual void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getMetricMin ( double &  x,
double &  y,
double &  z 
)
virtual

minimum value of the bounding box of all known space in x, y, z

template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getMetricMin ( double &  x,
double &  y,
double &  z 
) const

minimum value of the bounding box of all known space in x, y, z

template<class NODE, class INTERFACE>
virtual void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getMetricSize ( double &  x,
double &  y,
double &  z 
)
virtual

Size of OcTree (all known space) in meters for x, y and z dimension.

template<class NODE, class INTERFACE>
virtual void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getMetricSize ( double &  x,
double &  y,
double &  z 
) const
virtual

Size of OcTree (all known space) in meters for x, y and z dimension.

template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::getNodeSize ( unsigned  depth) const
inline

Definition at line 111 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::getNumLeafNodes ( ) const

Traverses the tree to calculate the total number of leaf nodes.

template<class NODE, class INTERFACE>
size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::getNumLeafNodesRecurs ( const NODE *  parent) const
protected
template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::getResolution ( ) const
inline

Definition at line 107 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
NODE* octomap::OcTreeBaseImpl< NODE, INTERFACE >::getRoot ( ) const
inline
Returns
Pointer to the root node of the tree. This pointer should not be modified or deleted externally, the OcTree manages its memory itself.

Definition at line 118 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
unsigned int octomap::OcTreeBaseImpl< NODE, INTERFACE >::getTreeDepth ( ) const
inline

Definition at line 109 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
std::string octomap::OcTreeBaseImpl< NODE, INTERFACE >::getTreeType ( ) const
inline

Definition at line 102 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::getUnknownLeafCenters ( point3d_list node_centers,
point3d  pmin,
point3d  pmax 
) const

return centers of leafs that do NOT exist (but could) in a given bounding box

template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::keyToCoord ( unsigned short int  key,
unsigned  depth 
) const

converts from a discrete key at a given depth into a coordinate corresponding to the key's center

Referenced by octomap::OcTreeBaseImpl< OcTreeNodeStamped, AbstractOccupancyOcTree >::DEPRECATED(), and octomap::OcTreeBaseImpl< OcTreeNodeStamped, AbstractOccupancyOcTree >::keyToCoord().

template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::keyToCoord ( unsigned short int  key) const
inline

converts from a discrete key at the lowest tree level into a coordinate corresponding to the key's center

Definition at line 421 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
point3d octomap::OcTreeBaseImpl< NODE, INTERFACE >::keyToCoord ( const OcTreeKey key) const
inline

converts from an addressing key at the lowest tree level into a coordinate corresponding to the key's center

Definition at line 427 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
point3d octomap::OcTreeBaseImpl< NODE, INTERFACE >::keyToCoord ( const OcTreeKey key,
unsigned  depth 
) const
inline

converts from an addressing key at a given depth into a coordinate corresponding to the key's center

Definition at line 433 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::memoryFullGrid ( ) const
Returns
Memory usage of a full grid of the same size as the OcTree in bytes (for comparison)
template<class NODE, class INTERFACE>
virtual size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::memoryUsage ( ) const
virtual
Returns
Memory usage of the complete octree in bytes (may vary between architectures)
template<class NODE, class INTERFACE>
virtual size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::memoryUsageNode ( ) const
inlinevirtual
Returns
Memory usage of the a single octree node

Definition at line 182 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
OcTreeBaseImpl<NODE,INTERFACE>& octomap::OcTreeBaseImpl< NODE, INTERFACE >::operator= ( const OcTreeBaseImpl< NODE, INTERFACE > &  )
private

Assignment operator is private: don't (re-)assign octrees (const-parameters can't be changed) - use the copy constructor instead.

template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::operator== ( const OcTreeBaseImpl< NODE, INTERFACE > &  rhs) const
template<class NODE, class INTERFACE>
virtual void octomap::OcTreeBaseImpl< NODE, INTERFACE >::prune ( )
virtual

Lossless compression of OcTree: merge children to parent when there are eight children with identical values.

template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::pruneRecurs ( NODE *  node,
unsigned int  depth,
unsigned int  max_depth,
unsigned int &  num_pruned 
)
protected

recursive call of prune()

template<class NODE, class INTERFACE>
std::istream& octomap::OcTreeBaseImpl< NODE, INTERFACE >::readData ( std::istream &  s)

Read all nodes from the input stream (without file header), for this the tree needs to be already created.

For general file IO, you should probably use AbstractOcTree::read() instead.

template<class NODE, class INTERFACE>
NODE* octomap::OcTreeBaseImpl< NODE, INTERFACE >::search ( double  x,
double  y,
double  z,
unsigned int  depth = 0 
) const

Search node at specified depth given a 3d point (depth=0: search full tree depth)

Returns
pointer to node if found, NULL otherwise
template<class NODE, class INTERFACE>
NODE* octomap::OcTreeBaseImpl< NODE, INTERFACE >::search ( const point3d value,
unsigned int  depth = 0 
) const

Search node at specified depth given a 3d point (depth=0: search full tree depth)

Returns
pointer to node if found, NULL otherwise
template<class NODE, class INTERFACE>
NODE* octomap::OcTreeBaseImpl< NODE, INTERFACE >::search ( const OcTreeKey key,
unsigned int  depth = 0 
) const

Search a node at specified depth given an addressing key (depth=0: search full tree depth)

Returns
pointer to node if found, NULL otherwise
template<class NODE, class INTERFACE>
void octomap::OcTreeBaseImpl< NODE, INTERFACE >::setResolution ( double  r)

Change the resolution of the octree, scaling all voxels.

This will not preserve the (metric) scale!

template<class NODE, class INTERFACE>
virtual size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::size ( ) const
inlinevirtual
Returns
The number of nodes in the tree

Definition at line 176 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::volume ( ) const
template<class NODE, class INTERFACE>
std::ostream& octomap::OcTreeBaseImpl< NODE, INTERFACE >::writeData ( std::ostream &  s) const

Write complete state of tree to stream (without file header) unmodified.

Pruning the tree first produces smaller files (lossless compression)

Member Data Documentation

template<class NODE, class INTERFACE>
KeyRay octomap::OcTreeBaseImpl< NODE, INTERFACE >::keyray
protected

Definition at line 544 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
const leaf_bbx_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::leaf_iterator_bbx_end
protected
template<class NODE, class INTERFACE>
const leaf_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::leaf_iterator_end
protected
template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::max_value[3]
protected

max in x, y, z

Definition at line 539 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::min_value[3]
protected

min in x, y, z

Definition at line 540 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::resolution
protected
template<class NODE, class INTERFACE>
double octomap::OcTreeBaseImpl< NODE, INTERFACE >::resolution_factor
protected
template<class NODE, class INTERFACE>
NODE* octomap::OcTreeBaseImpl< NODE, INTERFACE >::root
protected
template<class NODE, class INTERFACE>
bool octomap::OcTreeBaseImpl< NODE, INTERFACE >::size_changed
protected

flag to denote whether the octree extent changed (for lazy min/max eval)

Definition at line 535 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
std::vector<double> octomap::OcTreeBaseImpl< NODE, INTERFACE >::sizeLookupTable
protected

contains the size of a voxel at level i (0: root node). tree_depth+1 levels (incl. 0)

Definition at line 542 of file OcTreeBaseImpl.h.

Referenced by octomap::OcTreeBaseImpl< NODE, INTERFACE >::iterator_base::operator*().

template<class NODE, class INTERFACE>
point3d octomap::OcTreeBaseImpl< NODE, INTERFACE >::tree_center
protected

Definition at line 537 of file OcTreeBaseImpl.h.

template<class NODE, class INTERFACE>
const unsigned int octomap::OcTreeBaseImpl< NODE, INTERFACE >::tree_depth
protected
template<class NODE, class INTERFACE>
const tree_iterator octomap::OcTreeBaseImpl< NODE, INTERFACE >::tree_iterator_end
protected
template<class NODE, class INTERFACE>
const unsigned int octomap::OcTreeBaseImpl< NODE, INTERFACE >::tree_max_val
protected
template<class NODE, class INTERFACE>
size_t octomap::OcTreeBaseImpl< NODE, INTERFACE >::tree_size
protected

number of nodes in tree

Definition at line 533 of file OcTreeBaseImpl.h.

Referenced by octomap::OcTreeBaseImpl< OcTreeNodeStamped, AbstractOccupancyOcTree >::size().




Page generated by Doxygen 1.8.9.1 for MRPT 1.3.2 SVN:Unversioned directory at Tue Dec 8 09:49:21 UTC 2015