40 #ifndef PCL_OCTREE_VOXELCENTROID_HPP 41 #define PCL_OCTREE_VOXELCENTROID_HPP 50 #include <pcl/octree/impl/octree_pointcloud.hpp> 53 template<
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
bool 55 const PointT& point_arg,
PointT& voxel_centroid_arg)
const 58 LeafContainerT* leaf = NULL;
61 genOctreeKeyforPoint (point_arg, key);
63 leaf = this->findLeaf (key);
65 leaf->getCentroid (voxel_centroid_arg);
67 return (leaf != NULL);
71 template<
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
size_t 78 voxel_centroid_list_arg.clear ();
79 voxel_centroid_list_arg.reserve (this->leaf_count_);
81 getVoxelCentroidsRecursive (this->root_node_, new_key, voxel_centroid_list_arg );
84 return (voxel_centroid_list_arg.size ());
88 template<
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
void 94 unsigned char child_idx;
97 for (child_idx = 0; child_idx < 8; child_idx++)
100 if (branch_arg->
hasChild (child_idx))
112 getVoxelCentroidsRecursive (static_cast<const BranchNode*> (child_node), key_arg, voxel_centroid_list_arg);
119 LeafNode* container = static_cast<LeafNode*> (child_node);
123 voxel_centroid_list_arg.push_back (new_centroid);
137 #define PCL_INSTANTIATE_OctreePointCloudVoxelCentroid(T) template class PCL_EXPORTS pcl::octree::OctreePointCloudVoxelCentroid<T>; bool hasChild(unsigned char child_idx_arg) const
Check if branch is pointing to a particular child node.
bool getVoxelCentroidAtPoint(const PointT &point_arg, PointT &voxel_centroid_arg) const
Get centroid for a single voxel addressed by a PointT point.
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
const ContainerT & getContainer() const
Get const reference to container.
OctreeNode * getChildPtr(unsigned char child_idx_arg) const
Get pointer to child.
void getVoxelCentroidsRecursive(const BranchNode *branch_arg, OctreeKey &key_arg, typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const
Recursively explore the octree and output a PointT vector of centroids for all occupied voxels.
void popBranch()
pop child node from octree key
size_t getVoxelCentroids(typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const
Get PointT vector of centroids for all occupied voxels.
Abstract octree leaf class
A point structure representing Euclidean xyz coordinates, and the RGB color.
Abstract octree branch class
void pushBranch(unsigned char childIndex)
push a child node to the octree key
Abstract octree node class