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>
59 LeafContainerT* leaf = NULL;
62 genOctreeKeyforPoint(point_arg, key);
64 leaf = this->findLeaf(key);
66 leaf->getCentroid(voxel_centroid_arg);
68 return (leaf != NULL);
72 template <
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
82 voxel_centroid_list_arg.clear();
83 voxel_centroid_list_arg.reserve(this->leaf_count_);
85 getVoxelCentroidsRecursive(this->root_node_, new_key, voxel_centroid_list_arg);
88 return (voxel_centroid_list_arg.size());
92 template <
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
102 for (
unsigned char child_idx = 0; child_idx < 8; child_idx++) {
104 if (branch_arg->hasChild(child_idx)) {
108 OctreeNode* child_node = branch_arg->getChildPtr(child_idx);
113 getVoxelCentroidsRecursive(static_cast<const BranchNode*>(child_node),
115 voxel_centroid_list_arg);
123 container->getContainer().getCentroid(new_centroid);
125 voxel_centroid_list_arg.push_back(new_centroid);
138 #define PCL_INSTANTIATE_OctreePointCloudVoxelCentroid(T) \
139 template class PCL_EXPORTS pcl::octree::OctreePointCloudVoxelCentroid<T>;
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...
std::vector< PointT, Eigen::aligned_allocator< PointT >> AlignedPointTVector
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
bool getVoxelCentroidAtPoint(const PointT &point_arg, PointT &voxel_centroid_arg) const
Get centroid for a single voxel addressed by a PointT point.
void popBranch()
pop child node from octree key
typename OctreeT::LeafNode LeafNode
typename OctreeT::BranchNode BranchNode
A point structure representing Euclidean xyz coordinates, and the RGB color.
void pushBranch(unsigned char childIndex)
push a child node to the octree key
Abstract octree node class
std::size_t getVoxelCentroids(typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const
Get PointT vector of centroids for all occupied voxels.