octomap  1.9.7
OcTreeBaseImpl.h
Go to the documentation of this file.
1 /*
2  * OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees
3  * https://octomap.github.io/
4  *
5  * Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg
6  * All rights reserved.
7  * License: New BSD
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the University of Freiburg nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef OCTOMAP_OCTREE_BASE_IMPL_H
35 #define OCTOMAP_OCTREE_BASE_IMPL_H
36 
37 
38 #include <list>
39 #include <limits>
40 #include <iterator>
41 #include <stack>
42 #include <bitset>
43 
44 #include "octomap_types.h"
45 #include "OcTreeKey.h"
46 #include "ScanGraph.h"
47 
48 
49 namespace octomap {
50 
51  // forward declaration for NODE children array
52  class AbstractOcTreeNode;
53 
54 
74  template <class NODE,class INTERFACE>
75  class OcTreeBaseImpl : public INTERFACE {
76 
77  public:
79  typedef NODE NodeType;
80 
81  // the actual iterator implementation is included here
82  // as a member from this file
84 
85  OcTreeBaseImpl(double resolution);
86  virtual ~OcTreeBaseImpl();
87 
90 
91 
99 
102  bool operator== (const OcTreeBaseImpl<NODE,INTERFACE>& rhs) const;
103 
104  std::string getTreeType() const {return "OcTreeBaseImpl";}
105 
108  void setResolution(double r);
109  inline double getResolution() const { return resolution; }
110 
111  inline unsigned int getTreeDepth () const { return tree_depth; }
112 
113  inline double getNodeSize(unsigned depth) const {assert(depth <= tree_depth); return sizeLookupTable[depth];}
114 
120  void clearKeyRays(){
121  keyrays.clear();
122  }
123 
124  // -- Tree structure operations formerly contained in the nodes ---
125 
127  NODE* createNodeChild(NODE* node, unsigned int childIdx);
128 
130  void deleteNodeChild(NODE* node, unsigned int childIdx);
131 
133  NODE* getNodeChild(NODE* node, unsigned int childIdx) const;
134 
136  const NODE* getNodeChild(const NODE* node, unsigned int childIdx) const;
137 
140  virtual bool isNodeCollapsible(const NODE* node) const;
141 
147  bool nodeChildExists(const NODE* node, unsigned int childIdx) const;
148 
153  bool nodeHasChildren(const NODE* node) const;
154 
163  virtual void expandNode(NODE* node);
164 
169  virtual bool pruneNode(NODE* node);
170 
171 
172  // --------
173 
179  inline NODE* getRoot() const { return root; }
180 
186  NODE* search(double x, double y, double z, unsigned int depth = 0) const;
187 
193  NODE* search(const point3d& value, unsigned int depth = 0) const;
194 
200  NODE* search(const OcTreeKey& key, unsigned int depth = 0) const;
201 
207  bool deleteNode(double x, double y, double z, unsigned int depth = 0);
208 
214  bool deleteNode(const point3d& value, unsigned int depth = 0);
215 
221  bool deleteNode(const OcTreeKey& key, unsigned int depth = 0);
222 
224  void clear();
225 
232  virtual void prune();
233 
236  virtual void expand();
237 
238  // -- statistics ----------------------
239 
241  virtual inline size_t size() const { return tree_size; }
242 
244  virtual size_t memoryUsage() const;
245 
247  virtual inline size_t memoryUsageNode() const {return sizeof(NODE); };
248 
251  unsigned long long memoryFullGrid() const;
252 
253  double volume();
254 
256  virtual void getMetricSize(double& x, double& y, double& z);
258  virtual void getMetricSize(double& x, double& y, double& z) const;
260  virtual void getMetricMin(double& x, double& y, double& z);
262  void getMetricMin(double& x, double& y, double& z) const;
264  virtual void getMetricMax(double& x, double& y, double& z);
266  void getMetricMax(double& x, double& y, double& z) const;
267 
269  size_t calcNumNodes() const;
270 
272  size_t getNumLeafNodes() const;
273 
274 
275  // -- access tree nodes ------------------
276 
278  void getUnknownLeafCenters(point3d_list& node_centers, point3d pmin, point3d pmax, unsigned int depth = 0) const;
279 
280 
281  // -- raytracing -----------------------
282 
293  bool computeRayKeys(const point3d& origin, const point3d& end, KeyRay& ray) const;
294 
295 
307  bool computeRay(const point3d& origin, const point3d& end, std::vector<point3d>& ray);
308 
309 
310  // file IO
311 
318  std::istream& readData(std::istream &s);
319 
322  std::ostream& writeData(std::ostream &s) const;
323 
325 
327  iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);};
329  const iterator end() const {return leaf_iterator_end;}; // TODO: RVE?
330 
332  leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);};
334  const leaf_iterator end_leafs() const {return leaf_iterator_end;}
335 
337  leaf_bbx_iterator begin_leafs_bbx(const OcTreeKey& min, const OcTreeKey& max, unsigned char maxDepth=0) const {
338  return leaf_bbx_iterator(this, min, max, maxDepth);
339  }
341  leaf_bbx_iterator begin_leafs_bbx(const point3d& min, const point3d& max, unsigned char maxDepth=0) const {
342  return leaf_bbx_iterator(this, min, max, maxDepth);
343  }
346 
348  tree_iterator begin_tree(unsigned char maxDepth=0) const {return tree_iterator(this, maxDepth);}
350  const tree_iterator end_tree() const {return tree_iterator_end;}
351 
352  //
353  // Key / coordinate conversion functions
354  //
355 
357  inline key_type coordToKey(double coordinate) const{
358  return ((int) floor(resolution_factor * coordinate)) + tree_max_val;
359  }
360 
362  key_type coordToKey(double coordinate, unsigned depth) const;
363 
364 
366  inline OcTreeKey coordToKey(const point3d& coord) const{
367  return OcTreeKey(coordToKey(coord(0)), coordToKey(coord(1)), coordToKey(coord(2)));
368  }
369 
371  inline OcTreeKey coordToKey(double x, double y, double z) const{
372  return OcTreeKey(coordToKey(x), coordToKey(y), coordToKey(z));
373  }
374 
376  inline OcTreeKey coordToKey(const point3d& coord, unsigned depth) const{
377  if (depth == tree_depth)
378  return coordToKey(coord);
379  else
380  return OcTreeKey(coordToKey(coord(0), depth), coordToKey(coord(1), depth), coordToKey(coord(2), depth));
381  }
382 
384  inline OcTreeKey coordToKey(double x, double y, double z, unsigned depth) const{
385  if (depth == tree_depth)
386  return coordToKey(x,y,z);
387  else
388  return OcTreeKey(coordToKey(x, depth), coordToKey(y, depth), coordToKey(z, depth));
389  }
390 
399  inline OcTreeKey adjustKeyAtDepth(const OcTreeKey& key, unsigned int depth) const{
400  if (depth == tree_depth)
401  return key;
402 
403  assert(depth <= tree_depth);
404  return OcTreeKey(adjustKeyAtDepth(key[0], depth), adjustKeyAtDepth(key[1], depth), adjustKeyAtDepth(key[2], depth));
405  }
406 
415  key_type adjustKeyAtDepth(key_type key, unsigned int depth) const;
416 
424  bool coordToKeyChecked(const point3d& coord, OcTreeKey& key) const;
425 
434  bool coordToKeyChecked(const point3d& coord, unsigned depth, OcTreeKey& key) const;
435 
445  bool coordToKeyChecked(double x, double y, double z, OcTreeKey& key) const;
446 
457  bool coordToKeyChecked(double x, double y, double z, unsigned depth, OcTreeKey& key) const;
458 
466  bool coordToKeyChecked(double coordinate, key_type& key) const;
467 
476  bool coordToKeyChecked(double coordinate, unsigned depth, key_type& key) const;
477 
480  double keyToCoord(key_type key, unsigned depth) const;
481 
484  inline double keyToCoord(key_type key) const{
485  return (double( (int) key - (int) this->tree_max_val ) +0.5) * this->resolution;
486  }
487 
490  inline point3d keyToCoord(const OcTreeKey& key) const{
491  return point3d(float(keyToCoord(key[0])), float(keyToCoord(key[1])), float(keyToCoord(key[2])));
492  }
493 
496  inline point3d keyToCoord(const OcTreeKey& key, unsigned depth) const{
497  return point3d(float(keyToCoord(key[0], depth)), float(keyToCoord(key[1], depth)), float(keyToCoord(key[2], depth)));
498  }
499 
500  protected:
503  OcTreeBaseImpl(double resolution, unsigned int tree_depth, unsigned int tree_max_val);
504 
506  void init();
507 
509  void calcMinMax();
510 
511  void calcNumNodesRecurs(NODE* node, size_t& num_nodes) const;
512 
514  std::istream& readNodesRecurs(NODE*, std::istream &s);
515 
517  std::ostream& writeNodesRecurs(const NODE*, std::ostream &s) const;
518 
521  void deleteNodeRecurs(NODE* node);
522 
524  bool deleteNodeRecurs(NODE* node, unsigned int depth, unsigned int max_depth, const OcTreeKey& key);
525 
527  void pruneRecurs(NODE* node, unsigned int depth, unsigned int max_depth, unsigned int& num_pruned);
528 
530  void expandRecurs(NODE* node, unsigned int depth, unsigned int max_depth);
531 
532  size_t getNumLeafNodesRecurs(const NODE* parent) const;
533 
534  private:
538 
539  protected:
540  void allocNodeChildren(NODE* node);
541 
542  NODE* root;
543 
544  // constants of the tree
545  const unsigned int tree_depth;
546  const unsigned int tree_max_val;
547  double resolution;
549 
550  size_t tree_size;
551  bool size_changed;
553 
554  point3d tree_center; // coordinate offset of tree
555 
556  double max_value[3];
557  double min_value[3];
558  std::vector<double> sizeLookupTable;
560 
562  std::vector<KeyRay> keyrays;
563 
567 
568 
569  };
570 
571 }
572 
574 
575 #endif
octomap::OcTreeBaseImpl::end_leafs_bbx
const leaf_bbx_iterator end_leafs_bbx() const
Definition: OcTreeBaseImpl.h:345
tree_iterator
Iterator over the complete tree (inner nodes and leafs).
Definition: OcTreeIterator.hxx:207
octomap::OcTreeBaseImpl::computeRayKeys
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 bea...
Definition: OcTreeBaseImpl.hxx:542
octomap::OcTreeBaseImpl::NodeType
NODE NodeType
Make the templated NODE type available from the outside.
Definition: OcTreeBaseImpl.h:79
octomap::key_type
uint16_t key_type
Definition: OcTreeKey.h:63
octomap::OcTreeBaseImpl
OcTree base class, to be used with with any kind of OcTreeDataNode.
Definition: OcTreeBaseImpl.h:75
octomap::OcTreeBaseImpl::search
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).
Definition: OcTreeBaseImpl.hxx:421
octomap::OcTreeBaseImpl::sizeLookupTable
std::vector< double > sizeLookupTable
Definition: OcTreeBaseImpl.h:559
octomap::OcTreeBaseImpl::keyToCoord
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
Definition: OcTreeBaseImpl.h:496
octomap::OcTreeBaseImpl::calcMinMax
void calcMinMax()
recalculates min and max in x, y, z. Does nothing when tree size didn't change.
Definition: OcTreeBaseImpl.hxx:900
octomap::OcTreeBaseImpl::size
virtual size_t size() const
Definition: OcTreeBaseImpl.h:241
octomap::OcTreeBaseImpl::~OcTreeBaseImpl
virtual ~OcTreeBaseImpl()
Definition: OcTreeBaseImpl.hxx:68
octomap::OcTreeBaseImpl::pruneNode
virtual bool pruneNode(NODE *node)
Prunes a node when it is collapsible.
Definition: OcTreeBaseImpl.hxx:267
octomap::OcTreeBaseImpl::end_leafs
const leaf_iterator end_leafs() const
Definition: OcTreeBaseImpl.h:334
octomap::OcTreeBaseImpl::expandRecurs
void expandRecurs(NODE *node, unsigned int depth, unsigned int max_depth)
recursive call of expand()
Definition: OcTreeBaseImpl.hxx:742
octomap::OcTreeBaseImpl::keyToCoord
point3d keyToCoord(const OcTreeKey &key) const
converts from an addressing key at the lowest tree level into a coordinate corresponding to the key's...
Definition: OcTreeBaseImpl.h:490
octomap::OcTreeBaseImpl::getNodeChild
NODE * getNodeChild(NODE *node, unsigned int childIdx) const
Definition: OcTreeBaseImpl.hxx:200
octomap::OcTreeBaseImpl::tree_max_val
const unsigned int tree_max_val
Definition: OcTreeBaseImpl.h:546
octomap::OcTreeBaseImpl::keyToCoord
double keyToCoord(key_type key, unsigned depth) const
converts from a discrete key at a given depth into a coordinate corresponding to the key's center
Definition: OcTreeBaseImpl.hxx:394
octomap::OcTreeBaseImpl::deleteNodeChild
void deleteNodeChild(NODE *node, unsigned int childIdx)
Deletes the i-th child of the node.
Definition: OcTreeBaseImpl.hxx:189
octomap::OcTreeBaseImpl::deleteNodeRecurs
void deleteNodeRecurs(NODE *node)
Recursively delete a node and all children. Deallocates memory but does NOT set the node ptr to NULL ...
Definition: OcTreeBaseImpl.hxx:662
octomap::OcTreeBaseImpl::begin_leafs
leaf_iterator begin_leafs(unsigned char maxDepth=0) const
Definition: OcTreeBaseImpl.h:332
octomap::OcTreeBaseImpl::allocNodeChildren
void allocNodeChildren(NODE *node)
Definition: OcTreeBaseImpl.hxx:286
octomap::OcTreeBaseImpl::coordToKey
OcTreeKey coordToKey(const point3d &coord) const
Converts from a 3D coordinate into a 3D addressing key.
Definition: OcTreeBaseImpl.h:366
octomap::OcTreeBaseImpl::keyToCoord
double keyToCoord(key_type key) const
converts from a discrete key at the lowest tree level into a coordinate corresponding to the key's ce...
Definition: OcTreeBaseImpl.h:484
octomap::OcTreeBaseImpl::setResolution
void setResolution(double r)
Change the resolution of the octree, scaling all voxels. This will not preserve the (metric) scale!
Definition: OcTreeBaseImpl.hxx:156
octomap::OcTreeBaseImpl::coordToKey
OcTreeKey coordToKey(const point3d &coord, unsigned depth) const
Converts from a 3D coordinate into a 3D addressing key at a given depth.
Definition: OcTreeBaseImpl.h:376
octomap::KeyRay
Definition: OcTreeKey.h:139
octomap::OcTreeBaseImpl::tree_depth
const unsigned int tree_depth
Maximum tree depth is fixed to 16 currently.
Definition: OcTreeBaseImpl.h:545
octomap::OcTreeBaseImpl::resolution_factor
double resolution_factor
= 1. / resolution
Definition: OcTreeBaseImpl.h:548
octomap::OcTreeBaseImpl::leaf_iterator_bbx_end
const leaf_bbx_iterator leaf_iterator_bbx_end
Definition: OcTreeBaseImpl.h:565
octomap::OcTreeBaseImpl::computeRay
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 ...
Definition: OcTreeBaseImpl.hxx:651
octomap::OcTreeBaseImpl::tree_center
point3d tree_center
Definition: OcTreeBaseImpl.h:554
leaf_iterator
Iterator to iterate over all leafs of the tree.
Definition: OcTreeIterator.hxx:263
octomap::OcTreeBaseImpl::root
NODE * root
Pointer to the root NODE, NULL for empty tree.
Definition: OcTreeBaseImpl.h:542
octomath::Vector3
This class represents a three-dimensional vector.
Definition: Vector3.h:50
octomap::OcTreeBaseImpl::writeNodesRecurs
std::ostream & writeNodesRecurs(const NODE *, std::ostream &s) const
recursive call of writeData()
Definition: OcTreeBaseImpl.hxx:771
octomap::OcTreeBaseImpl::getNumLeafNodesRecurs
size_t getNumLeafNodesRecurs(const NODE *parent) const
Definition: OcTreeBaseImpl.hxx:1095
OcTreeKey.h
octomap::OcTreeBaseImpl::getResolution
double getResolution() const
Definition: OcTreeBaseImpl.h:109
octomap::OcTreeBaseImpl::nodeChildExists
bool nodeChildExists(const NODE *node, unsigned int childIdx) const
Safe test if node has a child at index childIdx.
Definition: OcTreeBaseImpl.hxx:235
octomap::OcTreeBaseImpl::memoryUsage
virtual size_t memoryUsage() const
Definition: OcTreeBaseImpl.hxx:1039
octomap::OcTreeBaseImpl::end_tree
const tree_iterator end_tree() const
Definition: OcTreeBaseImpl.h:350
octomap::OcTreeBaseImpl::coordToKey
OcTreeKey coordToKey(double x, double y, double z) const
Converts from a 3D coordinate into a 3D addressing key.
Definition: OcTreeBaseImpl.h:371
octomap::OcTreeBaseImpl::getMetricMin
virtual void getMetricMin(double &x, double &y, double &z)
minimum value of the bounding box of all known space in x, y, z
Definition: OcTreeBaseImpl.hxx:942
octomap::OcTreeBaseImpl::min_value
double min_value[3]
min in x, y, z contains the size of a voxel at level i (0: root node). tree_depth+1 levels (incl....
Definition: OcTreeBaseImpl.h:557
octomap::OcTreeBaseImpl::expand
virtual void expand()
Expands all pruned nodes (reverse of prune())
Definition: OcTreeBaseImpl.hxx:536
octomap::OcTreeBaseImpl::coordToKey
key_type coordToKey(double coordinate) const
Converts from a single coordinate into a discrete key.
Definition: OcTreeBaseImpl.h:357
octomap::OcTreeBaseImpl::isNodeCollapsible
virtual bool isNodeCollapsible(const NODE *node) const
A node is collapsible if all children exist, don't have children of their own and have the same occup...
Definition: OcTreeBaseImpl.hxx:214
octomap::OcTreeBaseImpl::nodeHasChildren
bool nodeHasChildren(const NODE *node) const
Safe test if node has any children.
Definition: OcTreeBaseImpl.hxx:244
octomap::OcTreeBaseImpl::getMetricSize
virtual void getMetricSize(double &x, double &y, double &z)
Size of OcTree (all known space) in meters for x, y and z dimension.
Definition: OcTreeBaseImpl.hxx:872
octomap::OcTreeBaseImpl::prune
virtual void prune()
Lossless compression of the octree: A node will replace all of its eight children if they have identi...
Definition: OcTreeBaseImpl.hxx:523
octomap::OcTreeBaseImpl::max_value
double max_value[3]
max in x, y, z
Definition: OcTreeBaseImpl.h:556
octomap::OcTreeBaseImpl::getMetricMax
virtual void getMetricMax(double &x, double &y, double &z)
maximum value of the bounding box of all known space in x, y, z
Definition: OcTreeBaseImpl.hxx:950
octomap::OcTreeBaseImpl::memoryFullGrid
unsigned long long memoryFullGrid() const
Definition: OcTreeBaseImpl.hxx:850
octomap::OcTreeKey
OcTreeKey is a container class for internal key addressing.
Definition: OcTreeKey.h:70
octomap::OcTreeBaseImpl::calcNumNodes
size_t calcNumNodes() const
Traverses the tree to calculate the total number of nodes.
Definition: OcTreeBaseImpl.hxx:1016
octomap::OcTreeBaseImpl::begin
iterator begin(unsigned char maxDepth=0) const
Definition: OcTreeBaseImpl.h:327
octomap_types.h
octomap::OcTreeBaseImpl::calcNumNodesRecurs
void calcNumNodesRecurs(NODE *node, size_t &num_nodes) const
Definition: OcTreeBaseImpl.hxx:1026
octomap::OcTreeBaseImpl::writeData
std::ostream & writeData(std::ostream &s) const
Write complete state of tree to stream (without file header) unmodified. Pruning the tree first produ...
Definition: OcTreeBaseImpl.hxx:763
octomap::OcTreeBaseImpl::deleteNode
bool deleteNode(double x, double y, double z, unsigned int depth=0)
Delete a node (if exists) given a 3d point.
Definition: OcTreeBaseImpl.hxx:488
octomap::OcTreeBaseImpl::clear
void clear()
Deletes the complete tree structure.
Definition: OcTreeBaseImpl.hxx:512
octomap::OcTreeBaseImpl::iterator
leaf_iterator iterator
Definition: OcTreeBaseImpl.h:324
octomap::OcTreeBaseImpl::getNumLeafNodes
size_t getNumLeafNodes() const
Traverses the tree to calculate the total number of leaf nodes.
Definition: OcTreeBaseImpl.hxx:1086
octomap::OcTreeBaseImpl::operator==
bool operator==(const OcTreeBaseImpl< NODE, INTERFACE > &rhs) const
Comparison between two octrees, all meta data, all nodes, and the structure must be identical.
Definition: OcTreeBaseImpl.hxx:125
octomap::OcTreeBaseImpl::begin_tree
tree_iterator begin_tree(unsigned char maxDepth=0) const
Definition: OcTreeBaseImpl.h:348
octomap::point3d_list
std::list< octomath::Vector3 > point3d_list
Definition: octomap_types.h:54
octomap::OcTreeBaseImpl::adjustKeyAtDepth
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)
Definition: OcTreeBaseImpl.h:399
octomap::OcTreeBaseImpl::keyrays
std::vector< KeyRay > keyrays
data structure for ray casting, array for multithreading
Definition: OcTreeBaseImpl.h:562
octomap::OcTreeBaseImpl::createNodeChild
NODE * createNodeChild(NODE *node, unsigned int childIdx)
Creates (allocates) the i-th child of the node.
Definition: OcTreeBaseImpl.hxx:173
octomap::OcTreeBaseImpl::getNodeSize
double getNodeSize(unsigned depth) const
Definition: OcTreeBaseImpl.h:113
octomap::OcTreeBaseImpl::tree_size
size_t tree_size
number of nodes in tree flag to denote whether the octree extent changed (for lazy min/max eval)
Definition: OcTreeBaseImpl.h:550
leaf_bbx_iterator
Bounding-box leaf iterator.
Definition: OcTreeIterator.hxx:335
octomap::OcTreeBaseImpl::getUnknownLeafCenters
void getUnknownLeafCenters(point3d_list &node_centers, point3d pmin, point3d pmax, unsigned int depth=0) const
return centers of leafs that do NOT exist (but could) in a given bounding box
Definition: OcTreeBaseImpl.hxx:1046
octomap::OcTreeBaseImpl::end
const iterator end() const
Definition: OcTreeBaseImpl.h:329
octomap::OcTreeBaseImpl::begin_leafs_bbx
leaf_bbx_iterator begin_leafs_bbx(const point3d &min, const point3d &max, unsigned char maxDepth=0) const
Definition: OcTreeBaseImpl.h:341
octomap::OcTreeBaseImpl::pruneRecurs
void pruneRecurs(NODE *node, unsigned int depth, unsigned int max_depth, unsigned int &num_pruned)
recursive call of prune()
Definition: OcTreeBaseImpl.hxx:719
octomap::OcTreeBaseImpl::getRoot
NODE * getRoot() const
Definition: OcTreeBaseImpl.h:179
octomap::OcTreeBaseImpl::memoryUsageNode
virtual size_t memoryUsageNode() const
Definition: OcTreeBaseImpl.h:247
octomap::OcTreeBaseImpl::readNodesRecurs
std::istream & readNodesRecurs(NODE *, std::istream &s)
recursive call of readData()
Definition: OcTreeBaseImpl.hxx:824
OcTreeIterator.hxx
octomap::OcTreeBaseImpl::leaf_iterator_end
const leaf_iterator leaf_iterator_end
Definition: OcTreeBaseImpl.h:564
octomap
Tables used by the Marching Cubes Algorithm The tables are from Paul Bourke's web page http://paulbou...
octomap::OcTreeBaseImpl::size_changed
bool size_changed
Definition: OcTreeBaseImpl.h:552
octomap::OcTreeBaseImpl::init
void init()
initialize non-trivial members, helper for constructors
Definition: OcTreeBaseImpl.hxx:87
octomap::OcTreeBaseImpl::getTreeType
std::string getTreeType() const
Definition: OcTreeBaseImpl.h:104
octomap::OcTreeBaseImpl::volume
double volume()
Definition: OcTreeBaseImpl.hxx:1112
octomap::OcTreeBaseImpl::coordToKeyChecked
bool coordToKeyChecked(const point3d &coord, OcTreeKey &key) const
Converts a 3D coordinate into a 3D OcTreeKey, with boundary checking.
Definition: OcTreeBaseImpl.hxx:340
octomap::OcTreeBaseImpl::readData
std::istream & readData(std::istream &s)
Read all nodes from the input stream (without file header), for this the tree needs to be already cre...
Definition: OcTreeBaseImpl.hxx:801
octomap::OcTreeBaseImpl::OcTreeBaseImpl
OcTreeBaseImpl(double resolution)
Definition: OcTreeBaseImpl.hxx:46
octomap::OcTreeBaseImpl::coordToKey
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.
Definition: OcTreeBaseImpl.h:384
octomap::OcTreeBaseImpl::resolution
double resolution
in meters
Definition: OcTreeBaseImpl.h:547
octomap::OcTreeBaseImpl::clearKeyRays
void clearKeyRays()
Clear KeyRay vector to minimize unneeded memory.
Definition: OcTreeBaseImpl.h:120
octomap::point3d
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
Definition: octomap_types.h:49
OcTreeBaseImpl.hxx
octomap::OcTreeBaseImpl::swapContent
void swapContent(OcTreeBaseImpl< NODE, INTERFACE > &rhs)
Swap contents of two octrees, i.e., only the underlying pointer / tree structure.
Definition: OcTreeBaseImpl.hxx:114
ScanGraph.h
octomap::OcTreeBaseImpl::begin_leafs_bbx
leaf_bbx_iterator begin_leafs_bbx(const OcTreeKey &min, const OcTreeKey &max, unsigned char maxDepth=0) const
Definition: OcTreeBaseImpl.h:337
octomap::OcTreeBaseImpl::expandNode
virtual void expandNode(NODE *node)
Expands a node (reverse of pruning): All children are created and their occupancy probability is set ...
Definition: OcTreeBaseImpl.hxx:257
octomap::OcTreeBaseImpl::tree_iterator_end
const tree_iterator tree_iterator_end
Definition: OcTreeBaseImpl.h:566
octomap::OcTreeBaseImpl::getTreeDepth
unsigned int getTreeDepth() const
Definition: OcTreeBaseImpl.h:111