Point Cloud Library (PCL)
1.11.1-dev
|
41 #include <pcl/octree/octree_container.h>
42 #include <pcl/octree/octree_iterator.h>
43 #include <pcl/octree/octree_key.h>
44 #include <pcl/octree/octree_nodes.h>
60 template <
typename LeafContainerT = int,
61 typename BranchContainerT = OctreeContainerEmpty>
112 begin(
unsigned int max_depth_arg = 0u)
114 return Iterator(
this, max_depth_arg ? max_depth_arg : this->octree_depth_);
139 this, max_depth_arg ? max_depth_arg : this->octree_depth_);
156 max_depth_arg ? max_depth_arg : this->octree_depth_);
173 max_depth_arg ? max_depth_arg : this->octree_depth_);
207 this, max_depth_arg ? max_depth_arg : this->octree_depth_);
277 createLeaf(
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg);
287 findLeaf(
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg);
298 unsigned int idx_y_arg,
299 unsigned int idx_z_arg)
const;
307 removeLeaf(
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg);
349 std::vector<LeafContainerT*>& leaf_container_vector_arg);
357 serializeLeafs(std::vector<LeafContainerT*>& leaf_container_vector_arg);
375 std::vector<LeafContainerT*>& leaf_container_vector_arg);
407 LeafContainerT* result =
nullptr;
419 return (
findLeaf(key_arg) !=
nullptr);
452 return (branch_arg.
getChildPtr(child_idx_arg) !=
nullptr);
473 unsigned char child_idx_arg,
476 branch_arg[child_idx_arg] = new_child_arg;
490 for (
unsigned char i = 0; i < 8; i++) {
492 node_bits |=
static_cast<char>((!!child) << i);
505 if (branch_arg.
hasChild(child_idx_arg)) {
506 OctreeNode* branch_child = branch_arg[child_idx_arg];
526 branch_arg[child_idx_arg] =
nullptr;
537 for (
char i = 0; i < 8; i++)
550 branch_arg[child_idx_arg] =
static_cast<OctreeNode*
>(new_branch_child);
552 return new_branch_child;
564 branch_arg[child_idx_arg] =
static_cast<OctreeNode*
>(new_leaf_child);
566 return new_leaf_child;
585 unsigned int depth_mask_arg,
600 unsigned int depth_mask_arg,
602 LeafContainerT*& result_arg)
const;
614 unsigned int depth_mask_arg,
629 std::vector<char>* binary_tree_out_arg,
630 typename std::vector<LeafContainerT*>* leaf_container_vector_arg)
const;
647 unsigned int depth_mask_arg,
649 typename std::vector<char>::const_iterator& binary_tree_input_it_arg,
650 typename std::vector<char>::const_iterator& binary_tree_input_it_end_arg,
651 typename std::vector<LeafContainerT*>::const_iterator*
652 leaf_container_vector_it_arg,
653 typename std::vector<LeafContainerT*>::const_iterator*
654 leaf_container_vector_it_end_arg);
689 #ifdef PCL_NO_PRECOMPILE
690 #include <pcl/octree/impl/octree_base.hpp>
void setMaxVoxelIndex(unsigned int max_voxel_index_arg)
Set the maximum amount of voxels per dimension.
OctreeDepthFirstIterator< OctreeT > Iterator
LeafContainerT * createLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg)
Create new leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
Defines all the PCL and non-PCL macros used.
OctreeNode * getBranchChildPtr(const BranchNode &branch_arg, unsigned char child_idx_arg) const
Retrieve a child node pointer for child node at child_idx.
unsigned int depth_mask_
Depth mask based on octree depth
void deserializeTree(std::vector< char > &binary_tree_input_arg)
Deserialize a binary octree description vector and create a corresponding octree structure.
void deleteTree()
Delete the octree structure and its leaf nodes.
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
const DepthFirstIterator depth_end()
bool deleteLeafRecursive(const OctreeKey &key_arg, unsigned int depth_mask_arg, BranchNode *branch_arg)
Recursively search and delete leaf node.
const FixedDepthIterator fixed_depth_end()
bool branchHasChild(const BranchNode &branch_arg, unsigned char child_idx_arg) const
Check if branch is pointing to a particular child node.
OctreeBase & operator=(const OctreeBase &source)
Copy operator.
void setTreeDepth(unsigned int max_depth_arg)
Set the maximum depth of the octree.
Iterator begin(unsigned int max_depth_arg=0u)
OctreeBase()
Empty constructor.
const LeafNodeBreadthFirstIterator leaf_breadth_end()
const LeafNodeDepthFirstIterator leaf_depth_end()
virtual ~OctreeBase()
Empty deconstructor.
LeafNode * createLeafChild(BranchNode &branch_arg, unsigned char child_idx_arg)
Create and add a new leaf child to a branch class.
unsigned int octree_depth_
Octree depth.
void deleteBranch(BranchNode &branch_arg)
Delete branch and all its subchilds from octree.
LeafContainerT * findLeaf(const OctreeKey &key_arg) const
Find leaf node.
OctreeBase(const OctreeBase &source)
Copy constructor.
Abstract octree node class
bool existLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg) const
idx_x_arg for the existence of leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
BranchNode * createBranchChild(BranchNode &branch_arg, unsigned char child_idx_arg)
Create and add a new branch child to a branch class.
Abstract octree leaf class
BreadthFirstIterator breadth_begin(unsigned int max_depth_arg=0u)
void serializeTree(std::vector< char > &binary_tree_out_arg)
Serialize octree into a binary output vector describing its branch node structure.
virtual void serializeTreeCallback(LeafContainerT &, const OctreeKey &) const
Callback executed for every leaf node during serialization.
unsigned int createLeafRecursive(const OctreeKey &key_arg, unsigned int depth_mask_arg, BranchNode *branch_arg, LeafNode *&return_leaf_arg, BranchNode *&parent_of_leaf_arg)
Create a leaf node at octree key.
BranchNode * root_node_
Pointer to root branch node of octree
void removeLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg)
Remove leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
void serializeLeafs(std::vector< LeafContainerT * > &leaf_container_vector_arg)
Outputs a vector of all LeafContainerT elements that are stored within the octree leaf nodes.
LeafContainerT * findLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg)
Find leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
OctreeLeafNode< LeafContainerT > LeafNode
Abstract octree branch class
OctreeDepthFirstIterator< OctreeT > DepthFirstIterator
bool octreeCanResize()
Test if octree is able to dynamically change its depth.
std::size_t getLeafCount() const
Return the amount of existing leafs in the octree.
virtual void deserializeTreeCallback(LeafContainerT &, const OctreeKey &)
Callback executed for every leaf node during deserialization.
Abstract octree iterator class
bool dynamic_depth_enabled_
Enable dynamic_depth.
OctreeKey max_key_
key range
OctreeBranchNode< BranchContainerT > BranchNode
OctreeBreadthFirstIterator< OctreeT > BreadthFirstIterator
OctreeNode * getRootNode() const
Retrieve root node.
OctreeLeafNodeBreadthFirstIterator< OctreeT > LeafNodeBreadthFirstIterator
void removeLeaf(const OctreeKey &key_arg)
Remove leaf node from octree.
unsigned int getTreeDepth() const
Get the maximum depth of the octree.
LeafNodeDepthFirstIterator leaf_depth_begin(unsigned int max_depth_arg=0u)
OctreeLeafNodeDepthFirstIterator< OctreeT > LeafNodeDepthFirstIterator
Octree leaf node iterator class.
LeafContainerT * createLeaf(const OctreeKey &key_arg)
Create a leaf node.
DepthFirstIterator depth_begin(unsigned int max_depth_arg=0u)
void deserializeTreeRecursive(BranchNode *branch_arg, unsigned int depth_mask_arg, OctreeKey &key_arg, typename std::vector< char >::const_iterator &binary_tree_input_it_arg, typename std::vector< char >::const_iterator &binary_tree_input_it_end_arg, typename std::vector< LeafContainerT * >::const_iterator *leaf_container_vector_it_arg, typename std::vector< LeafContainerT * >::const_iterator *leaf_container_vector_it_end_arg)
Recursive method for deserializing octree structure.
OctreeNode * getChildPtr(unsigned char child_idx_arg) const
Get pointer to child.
Octree leaf node iterator class.
FixedDepthIterator fixed_depth_begin(unsigned int fixed_depth_arg=0u)
char getBranchBitPattern(const BranchNode &branch_arg) const
Generate bit pattern reflecting the existence of child node pointers.
void findLeafRecursive(const OctreeKey &key_arg, unsigned int depth_mask_arg, BranchNode *branch_arg, LeafContainerT *&result_arg) const
Recursively search for a given leaf node and return a pointer.
bool hasChild(unsigned char child_idx_arg) const
Check if branch is pointing to a particular child node.
void setBranchChildPtr(BranchNode &branch_arg, unsigned char child_idx_arg, OctreeNode *new_child_arg)
Assign new child node to branch.
LeafNodeBreadthFirstIterator leaf_breadth_begin(unsigned int max_depth_arg=0u)
std::size_t leaf_count_
Amount of leaf nodes
bool existLeaf(const OctreeKey &key_arg) const
Check for existence of a leaf node in the octree.
OctreeFixedDepthIterator< OctreeT > FixedDepthIterator
const BreadthFirstIterator breadth_end()
Octree pointcloud voxel centroid leaf node class
void serializeTreeRecursive(const BranchNode *branch_arg, OctreeKey &key_arg, std::vector< char > *binary_tree_out_arg, typename std::vector< LeafContainerT * > *leaf_container_vector_arg) const
Recursively explore the octree and output binary octree description together with a vector of leaf no...
std::size_t getBranchCount() const
Return the amount of existing branch nodes in the octree.
std::size_t branch_count_
Amount of branch nodes
const ContainerT * getContainerPtr() const
Get const pointer to container.
void deleteBranchChild(BranchNode &branch_arg, unsigned char child_idx_arg)
Delete child node and all its subchilds from octree.
Octree container class that does not store any information.