summaryrefslogtreecommitdiff
path: root/octree
diff options
context:
space:
mode:
authorJochen Sprickerhof <git@jochen.sprickerhof.de>2021-09-25 18:36:20 +0200
committerJochen Sprickerhof <git@jochen.sprickerhof.de>2021-09-25 18:36:20 +0200
commitb73b4a1ab4e48791a53805e7658f47c0b2e3dfc3 (patch)
treeba05bd9e9e134fe0a72b7ebd29cfae0a3699f0dc /octree
parent5709ff5a246ba14d3ce28d5c6a4f0d1c4d2e0f0f (diff)
New upstream version 1.12.0+dfsg
Diffstat (limited to 'octree')
-rw-r--r--octree/include/pcl/octree/boost.h1
-rw-r--r--octree/include/pcl/octree/impl/octree2buf_base.hpp70
-rw-r--r--octree/include/pcl/octree/impl/octree_base.hpp46
-rw-r--r--octree/include/pcl/octree/impl/octree_iterator.hpp25
-rw-r--r--octree/include/pcl/octree/impl/octree_pointcloud.hpp104
-rw-r--r--octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp27
-rw-r--r--octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp2
-rw-r--r--octree/include/pcl/octree/impl/octree_search.hpp126
-rw-r--r--octree/include/pcl/octree/octree2buf_base.h68
-rw-r--r--octree/include/pcl/octree/octree_base.h67
-rw-r--r--octree/include/pcl/octree/octree_container.h50
-rw-r--r--octree/include/pcl/octree/octree_iterator.h63
-rw-r--r--octree/include/pcl/octree/octree_key.h16
-rw-r--r--octree/include/pcl/octree/octree_nodes.h3
-rw-r--r--octree/include/pcl/octree/octree_pointcloud.h34
-rw-r--r--octree/include/pcl/octree/octree_pointcloud_adjacency.h6
-rw-r--r--octree/include/pcl/octree/octree_pointcloud_adjacency_container.h10
-rw-r--r--octree/include/pcl/octree/octree_pointcloud_changedetector.h6
-rw-r--r--octree/include/pcl/octree/octree_pointcloud_density.h17
-rw-r--r--octree/include/pcl/octree/octree_pointcloud_singlepoint.h3
-rw-r--r--octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h11
-rw-r--r--octree/include/pcl/octree/octree_search.h106
-rw-r--r--octree/src/octree_inst.cpp4
23 files changed, 401 insertions, 464 deletions
diff --git a/octree/include/pcl/octree/boost.h b/octree/include/pcl/octree/boost.h
index 3510b239..b3680aab 100644
--- a/octree/include/pcl/octree/boost.h
+++ b/octree/include/pcl/octree/boost.h
@@ -42,6 +42,7 @@
#ifdef __GNUC__
#pragma GCC system_header
#endif
+PCL_DEPRECATED_HEADER(1, 15, "Please include the needed boost headers directly.")
// Marking all Boost headers as system headers to remove warnings
#include <boost/graph/adjacency_list.hpp>
diff --git a/octree/include/pcl/octree/impl/octree2buf_base.hpp b/octree/include/pcl/octree/impl/octree2buf_base.hpp
index edaea812..67628df6 100644
--- a/octree/include/pcl/octree/impl/octree2buf_base.hpp
+++ b/octree/include/pcl/octree/impl/octree2buf_base.hpp
@@ -67,17 +67,17 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::~Octree2BufBase()
template <typename LeafContainerT, typename BranchContainerT>
void
Octree2BufBase<LeafContainerT, BranchContainerT>::setMaxVoxelIndex(
- unsigned int max_voxel_index_arg)
+ uindex_t max_voxel_index_arg)
{
- unsigned int treeDepth;
+ uindex_t treeDepth;
assert(max_voxel_index_arg > 0);
// tree depth == amount of bits of maxVoxels
- treeDepth = std::max(
- (std::min(static_cast<unsigned int>(OctreeKey::maxDepth),
- static_cast<unsigned int>(std::ceil(std::log2(max_voxel_index_arg))))),
- static_cast<unsigned int>(0));
+ treeDepth =
+ std::max<uindex_t>(std::min<uindex_t>(OctreeKey::maxDepth,
+ std::ceil(std::log2(max_voxel_index_arg))),
+ 0);
// define depthMask_ by setting a single bit to 1 at bit position == tree depth
depth_mask_ = (1 << (treeDepth - 1));
@@ -86,7 +86,7 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::setMaxVoxelIndex(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
void
-Octree2BufBase<LeafContainerT, BranchContainerT>::setTreeDepth(unsigned int depth_arg)
+Octree2BufBase<LeafContainerT, BranchContainerT>::setTreeDepth(uindex_t depth_arg)
{
assert(depth_arg > 0);
@@ -103,9 +103,9 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::setTreeDepth(unsigned int dept
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
LeafContainerT*
-Octree2BufBase<LeafContainerT, BranchContainerT>::findLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg)
+Octree2BufBase<LeafContainerT, BranchContainerT>::findLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg)
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -117,9 +117,9 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::findLeaf(unsigned int idx_x_ar
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
LeafContainerT*
-Octree2BufBase<LeafContainerT, BranchContainerT>::createLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg)
+Octree2BufBase<LeafContainerT, BranchContainerT>::createLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg)
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -131,8 +131,9 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::createLeaf(unsigned int idx_x_
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
bool
-Octree2BufBase<LeafContainerT, BranchContainerT>::existLeaf(
- unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg) const
+Octree2BufBase<LeafContainerT, BranchContainerT>::existLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg) const
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -144,9 +145,9 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::existLeaf(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
void
-Octree2BufBase<LeafContainerT, BranchContainerT>::removeLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg)
+Octree2BufBase<LeafContainerT, BranchContainerT>::removeLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg)
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -352,10 +353,10 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::serializeNewLeafs(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
-unsigned int
+uindex_t
Octree2BufBase<LeafContainerT, BranchContainerT>::createLeafRecursive(
const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafNode*& return_leaf_arg,
BranchNode*& parent_of_leaf_arg,
@@ -431,6 +432,7 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::createLeafRecursive(
OctreeNode* child_node = branch_arg->getChildPtr(!buffer_selector_, child_idx);
if (child_node->getNodeType() == LEAF_NODE) {
child_leaf = static_cast<LeafNode*>(child_node);
+ child_leaf->getContainer() = LeafContainer(); // Clear contents of leaf
branch_arg->setChildPtr(buffer_selector_, child_idx, child_node);
}
else {
@@ -465,7 +467,7 @@ template <typename LeafContainerT, typename BranchContainerT>
void
Octree2BufBase<LeafContainerT, BranchContainerT>::findLeafRecursive(
const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafContainerT*& result_arg) const
{
@@ -500,7 +502,7 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::findLeafRecursive(
template <typename LeafContainerT, typename BranchContainerT>
bool
Octree2BufBase<LeafContainerT, BranchContainerT>::deleteLeafRecursive(
- const OctreeKey& key_arg, unsigned int depth_mask_arg, BranchNode* branch_arg)
+ const OctreeKey& key_arg, uindex_t depth_mask_arg, BranchNode* branch_arg)
{
// index to branch child
unsigned char child_idx;
@@ -559,21 +561,17 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::serializeTreeRecursive(
bool do_XOR_encoding_arg,
bool new_leafs_filter_arg)
{
- // bit pattern
- char branch_bit_pattern_curr_buffer;
- char branch_bit_pattern_prev_buffer;
- char node_XOR_bit_pattern;
-
- // occupancy bit patterns of branch node (current and previous octree buffer)
- branch_bit_pattern_curr_buffer = getBranchBitPattern(*branch_arg, buffer_selector_);
- branch_bit_pattern_prev_buffer = getBranchBitPattern(*branch_arg, !buffer_selector_);
-
- // XOR of current and previous occupancy bit patterns
- node_XOR_bit_pattern =
- branch_bit_pattern_curr_buffer ^ branch_bit_pattern_prev_buffer;
-
if (binary_tree_out_arg) {
+ // occupancy bit patterns of branch node (current octree buffer)
+ const char branch_bit_pattern_curr_buffer =
+ getBranchBitPattern(*branch_arg, buffer_selector_);
if (do_XOR_encoding_arg) {
+ // occupancy bit patterns of branch node (previous octree buffer)
+ const char branch_bit_pattern_prev_buffer =
+ getBranchBitPattern(*branch_arg, !buffer_selector_);
+ // XOR of current and previous occupancy bit patterns
+ const char node_XOR_bit_pattern =
+ branch_bit_pattern_curr_buffer ^ branch_bit_pattern_prev_buffer;
// write XOR bit pattern to output vector
binary_tree_out_arg->push_back(node_XOR_bit_pattern);
}
@@ -642,7 +640,7 @@ template <typename LeafContainerT, typename BranchContainerT>
void
Octree2BufBase<LeafContainerT, BranchContainerT>::deserializeTreeRecursive(
BranchNode* branch_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
OctreeKey& key_arg,
typename std::vector<char>::const_iterator& binaryTreeIT_arg,
typename std::vector<char>::const_iterator& binaryTreeIT_End_arg,
diff --git a/octree/include/pcl/octree/impl/octree_base.hpp b/octree/include/pcl/octree/impl/octree_base.hpp
index 5cca0142..afd9d3c8 100644
--- a/octree/include/pcl/octree/impl/octree_base.hpp
+++ b/octree/include/pcl/octree/impl/octree_base.hpp
@@ -39,8 +39,6 @@
#ifndef PCL_OCTREE_BASE_HPP
#define PCL_OCTREE_BASE_HPP
-#include <pcl/impl/instantiate.hpp>
-
#include <vector>
namespace pcl {
@@ -69,16 +67,16 @@ OctreeBase<LeafContainerT, BranchContainerT>::~OctreeBase()
template <typename LeafContainerT, typename BranchContainerT>
void
OctreeBase<LeafContainerT, BranchContainerT>::setMaxVoxelIndex(
- unsigned int max_voxel_index_arg)
+ uindex_t max_voxel_index_arg)
{
- unsigned int tree_depth;
+ uindex_t tree_depth;
assert(max_voxel_index_arg > 0);
// tree depth == bitlength of maxVoxels
tree_depth =
- std::min(static_cast<unsigned int>(OctreeKey::maxDepth),
- static_cast<unsigned int>(std::ceil(std::log2(max_voxel_index_arg))));
+ std::min(static_cast<uindex_t>(OctreeKey::maxDepth),
+ static_cast<uindex_t>(std::ceil(std::log2(max_voxel_index_arg))));
// define depthMask_ by setting a single bit to 1 at bit position == tree depth
depth_mask_ = (1 << (tree_depth - 1));
@@ -87,7 +85,7 @@ OctreeBase<LeafContainerT, BranchContainerT>::setMaxVoxelIndex(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
void
-OctreeBase<LeafContainerT, BranchContainerT>::setTreeDepth(unsigned int depth_arg)
+OctreeBase<LeafContainerT, BranchContainerT>::setTreeDepth(uindex_t depth_arg)
{
assert(depth_arg > 0);
@@ -104,9 +102,9 @@ OctreeBase<LeafContainerT, BranchContainerT>::setTreeDepth(unsigned int depth_ar
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
LeafContainerT*
-OctreeBase<LeafContainerT, BranchContainerT>::findLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg)
+OctreeBase<LeafContainerT, BranchContainerT>::findLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg)
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -118,9 +116,9 @@ OctreeBase<LeafContainerT, BranchContainerT>::findLeaf(unsigned int idx_x_arg,
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
LeafContainerT*
-OctreeBase<LeafContainerT, BranchContainerT>::createLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg)
+OctreeBase<LeafContainerT, BranchContainerT>::createLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg)
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -132,9 +130,9 @@ OctreeBase<LeafContainerT, BranchContainerT>::createLeaf(unsigned int idx_x_arg,
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
bool
-OctreeBase<LeafContainerT, BranchContainerT>::existLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg) const
+OctreeBase<LeafContainerT, BranchContainerT>::existLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg) const
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -146,9 +144,9 @@ OctreeBase<LeafContainerT, BranchContainerT>::existLeaf(unsigned int idx_x_arg,
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
void
-OctreeBase<LeafContainerT, BranchContainerT>::removeLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg)
+OctreeBase<LeafContainerT, BranchContainerT>::removeLeaf(uindex_t idx_x_arg,
+ uindex_t idx_y_arg,
+ uindex_t idx_z_arg)
{
// generate key
OctreeKey key(idx_x_arg, idx_y_arg, idx_z_arg);
@@ -283,10 +281,10 @@ OctreeBase<LeafContainerT, BranchContainerT>::deserializeTree(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename LeafContainerT, typename BranchContainerT>
-unsigned int
+uindex_t
OctreeBase<LeafContainerT, BranchContainerT>::createLeafRecursive(
const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafNode*& return_leaf_arg,
BranchNode*& parent_of_leaf_arg)
@@ -346,7 +344,7 @@ template <typename LeafContainerT, typename BranchContainerT>
void
OctreeBase<LeafContainerT, BranchContainerT>::findLeafRecursive(
const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafContainerT*& result_arg) const
{
@@ -383,7 +381,7 @@ OctreeBase<LeafContainerT, BranchContainerT>::findLeafRecursive(
template <typename LeafContainerT, typename BranchContainerT>
bool
OctreeBase<LeafContainerT, BranchContainerT>::deleteLeafRecursive(
- const OctreeKey& key_arg, unsigned int depth_mask_arg, BranchNode* branch_arg)
+ const OctreeKey& key_arg, uindex_t depth_mask_arg, BranchNode* branch_arg)
{
// index to branch child
unsigned char child_idx;
@@ -493,7 +491,7 @@ template <typename LeafContainerT, typename BranchContainerT>
void
OctreeBase<LeafContainerT, BranchContainerT>::deserializeTreeRecursive(
BranchNode* branch_arg,
- unsigned int depth_mask_arg,
+ uindex_t 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,
diff --git a/octree/include/pcl/octree/impl/octree_iterator.hpp b/octree/include/pcl/octree/impl/octree_iterator.hpp
index 76e33fab..1398cf5d 100644
--- a/octree/include/pcl/octree/impl/octree_iterator.hpp
+++ b/octree/include/pcl/octree/impl/octree_iterator.hpp
@@ -45,7 +45,7 @@ namespace pcl {
namespace octree {
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
-OctreeDepthFirstIterator<OctreeT>::OctreeDepthFirstIterator(unsigned int max_depth_arg)
+OctreeDepthFirstIterator<OctreeT>::OctreeDepthFirstIterator(uindex_t max_depth_arg)
: OctreeIteratorBase<OctreeT>(max_depth_arg), stack_()
{
// initialize iterator
@@ -55,7 +55,7 @@ OctreeDepthFirstIterator<OctreeT>::OctreeDepthFirstIterator(unsigned int max_dep
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
OctreeDepthFirstIterator<OctreeT>::OctreeDepthFirstIterator(OctreeT* octree_arg,
- unsigned int max_depth_arg)
+ uindex_t max_depth_arg)
: OctreeIteratorBase<OctreeT>(octree_arg, max_depth_arg), stack_()
{
// initialize iterator
@@ -163,8 +163,7 @@ OctreeDepthFirstIterator<OctreeT>::operator++()
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
-OctreeBreadthFirstIterator<OctreeT>::OctreeBreadthFirstIterator(
- unsigned int max_depth_arg)
+OctreeBreadthFirstIterator<OctreeT>::OctreeBreadthFirstIterator(uindex_t max_depth_arg)
: OctreeIteratorBase<OctreeT>(max_depth_arg), FIFO_()
{
OctreeIteratorBase<OctreeT>::reset();
@@ -175,8 +174,8 @@ OctreeBreadthFirstIterator<OctreeT>::OctreeBreadthFirstIterator(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
-OctreeBreadthFirstIterator<OctreeT>::OctreeBreadthFirstIterator(
- OctreeT* octree_arg, unsigned int max_depth_arg)
+OctreeBreadthFirstIterator<OctreeT>::OctreeBreadthFirstIterator(OctreeT* octree_arg,
+ uindex_t max_depth_arg)
: OctreeIteratorBase<OctreeT>(octree_arg, max_depth_arg), FIFO_()
{
OctreeIteratorBase<OctreeT>::reset();
@@ -259,13 +258,13 @@ OctreeBreadthFirstIterator<OctreeT>::operator++()
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
OctreeFixedDepthIterator<OctreeT>::OctreeFixedDepthIterator()
-: OctreeBreadthFirstIterator<OctreeT>(0u), fixed_depth_(0u)
+: OctreeBreadthFirstIterator<OctreeT>(nullptr, 0), fixed_depth_(0u)
{}
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
-OctreeFixedDepthIterator<OctreeT>::OctreeFixedDepthIterator(
- OctreeT* octree_arg, unsigned int fixed_depth_arg)
+OctreeFixedDepthIterator<OctreeT>::OctreeFixedDepthIterator(OctreeT* octree_arg,
+ uindex_t fixed_depth_arg)
: OctreeBreadthFirstIterator<OctreeT>(octree_arg, fixed_depth_arg)
, fixed_depth_(fixed_depth_arg)
{
@@ -275,7 +274,7 @@ OctreeFixedDepthIterator<OctreeT>::OctreeFixedDepthIterator(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
void
-OctreeFixedDepthIterator<OctreeT>::reset(unsigned int fixed_depth_arg)
+OctreeFixedDepthIterator<OctreeT>::reset(uindex_t fixed_depth_arg)
{
// Set the desired depth to walk through
fixed_depth_ = fixed_depth_arg;
@@ -315,7 +314,7 @@ OctreeFixedDepthIterator<OctreeT>::reset(unsigned int fixed_depth_arg)
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
OctreeLeafNodeBreadthFirstIterator<OctreeT>::OctreeLeafNodeBreadthFirstIterator(
- unsigned int max_depth_arg)
+ uindex_t max_depth_arg)
: OctreeBreadthFirstIterator<OctreeT>(max_depth_arg)
{
reset();
@@ -324,7 +323,7 @@ OctreeLeafNodeBreadthFirstIterator<OctreeT>::OctreeLeafNodeBreadthFirstIterator(
//////////////////////////////////////////////////////////////////////////////////////////////
template <typename OctreeT>
OctreeLeafNodeBreadthFirstIterator<OctreeT>::OctreeLeafNodeBreadthFirstIterator(
- OctreeT* octree_arg, unsigned int max_depth_arg)
+ OctreeT* octree_arg, uindex_t max_depth_arg)
: OctreeBreadthFirstIterator<OctreeT>(octree_arg, max_depth_arg)
{
reset();
@@ -334,7 +333,7 @@ OctreeLeafNodeBreadthFirstIterator<OctreeT>::OctreeLeafNodeBreadthFirstIterator(
template <typename OctreeT>
OctreeLeafNodeBreadthFirstIterator<OctreeT>::OctreeLeafNodeBreadthFirstIterator(
OctreeT* octree_arg,
- unsigned int max_depth_arg,
+ uindex_t max_depth_arg,
IteratorState* current_state,
const std::deque<IteratorState>& fifo)
: OctreeBreadthFirstIterator<OctreeT>(octree_arg, max_depth_arg, current_state, fifo)
diff --git a/octree/include/pcl/octree/impl/octree_pointcloud.hpp b/octree/include/pcl/octree/impl/octree_pointcloud.hpp
index 19bced45..a7507d32 100644
--- a/octree/include/pcl/octree/impl/octree_pointcloud.hpp
+++ b/octree/include/pcl/octree/impl/octree_pointcloud.hpp
@@ -41,6 +41,7 @@
#include <pcl/common/common.h>
#include <pcl/common/point_tests.h> // for pcl::isFinite
#include <pcl/octree/impl/octree_base.hpp>
+#include <pcl/types.h>
#include <cassert>
@@ -78,8 +79,8 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
addPointsFromInputCloud()
{
if (indices_) {
- for (const int& index : *indices_) {
- assert((index >= 0) && (index < static_cast<int>(input_->size())));
+ for (const auto& index : *indices_) {
+ assert((index >= 0) && (static_cast<std::size_t>(index) < input_->size()));
if (isFinite((*input_)[index])) {
// add points to octree
@@ -88,10 +89,10 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
}
}
else {
- for (std::size_t i = 0; i < input_->size(); i++) {
+ for (index_t i = 0; i < static_cast<index_t>(input_->size()); i++) {
if (isFinite((*input_)[i])) {
// add points to octree
- this->addPointIdx(static_cast<unsigned int>(i));
+ this->addPointIdx(i);
}
}
}
@@ -104,7 +105,7 @@ template <typename PointT,
typename OctreeT>
void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- addPointFromCloud(const int point_idx_arg, IndicesPtr indices_arg)
+ addPointFromCloud(const uindex_t point_idx_arg, IndicesPtr indices_arg)
{
this->addPointIdx(point_idx_arg);
if (indices_arg)
@@ -124,7 +125,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
cloud_arg->push_back(point_arg);
- this->addPointIdx(static_cast<const int>(cloud_arg->size()) - 1);
+ this->addPointIdx(cloud_arg->size() - 1);
}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -143,7 +144,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
cloud_arg->push_back(point_arg);
- this->addPointFromCloud(static_cast<const int>(cloud_arg->size()) - 1, indices_arg);
+ this->addPointFromCloud(cloud_arg->size() - 1, indices_arg);
}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -175,7 +176,7 @@ template <typename PointT,
typename OctreeT>
bool
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- isVoxelOccupiedAtPoint(const int& point_idx_arg) const
+ isVoxelOccupiedAtPoint(const index_t& point_idx_arg) const
{
// retrieve point from input cloud
const PointT& point = (*this->input_)[point_idx_arg];
@@ -233,7 +234,7 @@ template <typename PointT,
typename OctreeT>
void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- deleteVoxelAtPoint(const int& point_idx_arg)
+ deleteVoxelAtPoint(const index_t& point_idx_arg)
{
// retrieve point from input cloud
const PointT& point = (*this->input_)[point_idx_arg];
@@ -247,7 +248,7 @@ template <typename PointT,
typename LeafContainerT,
typename BranchContainerT,
typename OctreeT>
-int
+pcl::uindex_t
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
getOccupiedVoxelCenters(AlignedPointTVector& voxel_center_list_arg) const
{
@@ -264,7 +265,7 @@ template <typename PointT,
typename LeafContainerT,
typename BranchContainerT,
typename OctreeT>
-int
+pcl::uindex_t
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
getApproxIntersectedVoxelCentersBySegment(const Eigen::Vector3f& origin,
const Eigen::Vector3f& end,
@@ -277,14 +278,14 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
const float step_size = static_cast<float>(resolution_) * precision;
// Ensure we get at least one step for the first voxel.
- const int nsteps = std::max(1, static_cast<int>(norm / step_size));
+ const auto nsteps = std::max<std::size_t>(1, norm / step_size);
OctreeKey prev_key;
bool bkeyDefined = false;
// Walk along the line segment with small steps.
- for (int i = 0; i < nsteps; ++i) {
+ for (std::size_t i = 0; i < nsteps; ++i) {
Eigen::Vector3f p = origin + (direction * step_size * static_cast<float>(i));
PointT octree_p;
@@ -319,7 +320,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
voxel_center_list.push_back(center);
}
- return (static_cast<int>(voxel_center_list.size()));
+ return (static_cast<uindex_t>(voxel_center_list.size()));
}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -604,7 +605,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
expandLeafNode(LeafNode* leaf_node,
BranchNode* parent_branch,
unsigned char child_idx,
- unsigned int depth_mask)
+ uindex_t depth_mask)
{
if (depth_mask) {
@@ -612,7 +613,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
std::size_t leaf_obj_count = (*leaf_node)->getSize();
// copy leaf data
- std::vector<int> leafIndices;
+ Indices leafIndices;
leafIndices.reserve(leaf_obj_count);
(*leaf_node)->getPointIndices(leafIndices);
@@ -628,7 +629,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
// add data to new branch
OctreeKey new_index_key;
- for (const int& leafIndex : leafIndices) {
+ for (const auto& leafIndex : leafIndices) {
const PointT& point_from_index = (*input_)[leafIndex];
// generate key
@@ -651,11 +652,11 @@ template <typename PointT,
typename OctreeT>
void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- addPointIdx(const int point_idx_arg)
+ addPointIdx(const uindex_t point_idx_arg)
{
OctreeKey key;
- assert(point_idx_arg < static_cast<int>(input_->size()));
+ assert(point_idx_arg < input_->size());
const PointT& point = (*input_)[point_idx_arg];
@@ -667,7 +668,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
LeafNode* leaf_node;
BranchNode* parent_branch_of_leaf_node;
- unsigned int depth_mask = this->createLeafRecursive(
+ auto depth_mask = this->createLeafRecursive(
key, this->depth_mask_, this->root_node_, leaf_node, parent_branch_of_leaf_node);
if (this->dynamic_depth_enabled_ && depth_mask) {
@@ -699,10 +700,10 @@ template <typename PointT,
typename OctreeT>
const PointT&
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- getPointByIndex(const unsigned int index_arg) const
+ getPointByIndex(const uindex_t index_arg) const
{
// retrieve point from input cloud
- assert(index_arg < static_cast<unsigned int>(input_->size()));
+ assert(index_arg < input_->size());
return ((*this->input_)[index_arg]);
}
@@ -715,36 +716,28 @@ void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
getKeyBitSize()
{
- unsigned int max_voxels;
-
- unsigned int max_key_x;
- unsigned int max_key_y;
- unsigned int max_key_z;
-
- double octree_side_len;
-
const float minValue = std::numeric_limits<float>::epsilon();
// find maximum key values for x, y, z
- max_key_x =
- static_cast<unsigned int>(std::ceil((max_x_ - min_x_ - minValue) / resolution_));
- max_key_y =
- static_cast<unsigned int>(std::ceil((max_y_ - min_y_ - minValue) / resolution_));
- max_key_z =
- static_cast<unsigned int>(std::ceil((max_z_ - min_z_ - minValue) / resolution_));
+ const auto max_key_x =
+ static_cast<uindex_t>(std::ceil((max_x_ - min_x_ - minValue) / resolution_));
+ const auto max_key_y =
+ static_cast<uindex_t>(std::ceil((max_y_ - min_y_ - minValue) / resolution_));
+ const auto max_key_z =
+ static_cast<uindex_t>(std::ceil((max_z_ - min_z_ - minValue) / resolution_));
// find maximum amount of keys
- max_voxels = std::max(std::max(std::max(max_key_x, max_key_y), max_key_z),
- static_cast<unsigned int>(2));
+ const auto max_voxels =
+ std::max<uindex_t>(std::max(std::max(max_key_x, max_key_y), max_key_z), 2);
// tree depth == amount of bits of max_voxels
- this->octree_depth_ =
- std::max((std::min(static_cast<unsigned int>(OctreeKey::maxDepth),
- static_cast<unsigned int>(
- std::ceil(std::log2(max_voxels) - minValue)))),
- static_cast<unsigned int>(0));
+ this->octree_depth_ = std::max<uindex_t>(
+ std::min<uindex_t>(OctreeKey::maxDepth,
+ std::ceil(std::log2(max_voxels) - minValue)),
+ 0);
- octree_side_len = static_cast<double>(1 << this->octree_depth_) * resolution_;
+ const auto octree_side_len =
+ static_cast<double>(1 << this->octree_depth_) * resolution_;
if (this->leaf_count_ == 0) {
double octree_oversize_x;
@@ -792,12 +785,9 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
genOctreeKeyforPoint(const PointT& point_arg, OctreeKey& key_arg) const
{
// calculate integer key for point coordinates
- key_arg.x =
- static_cast<unsigned int>((point_arg.x - this->min_x_) / this->resolution_);
- key_arg.y =
- static_cast<unsigned int>((point_arg.y - this->min_y_) / this->resolution_);
- key_arg.z =
- static_cast<unsigned int>((point_arg.z - this->min_z_) / this->resolution_);
+ key_arg.x = static_cast<uindex_t>((point_arg.x - this->min_x_) / this->resolution_);
+ key_arg.y = static_cast<uindex_t>((point_arg.y - this->min_y_) / this->resolution_);
+ key_arg.z = static_cast<uindex_t>((point_arg.z - this->min_z_) / this->resolution_);
assert(key_arg.x <= this->max_key_.x);
assert(key_arg.y <= this->max_key_.y);
@@ -833,7 +823,7 @@ template <typename PointT,
typename OctreeT>
bool
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- genOctreeKeyForDataT(const int& data_arg, OctreeKey& key_arg) const
+ genOctreeKeyForDataT(const index_t& data_arg, OctreeKey& key_arg) const
{
const PointT temp_point = getPointByIndex(data_arg);
@@ -869,7 +859,7 @@ template <typename PointT,
void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
genVoxelCenterFromOctreeKey(const OctreeKey& key_arg,
- unsigned int tree_depth_arg,
+ uindex_t tree_depth_arg,
PointT& point_arg) const
{
// generate point for voxel center defined by treedepth (bitLen) and key
@@ -898,7 +888,7 @@ template <typename PointT,
void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
genVoxelBoundsFromOctreeKey(const OctreeKey& key_arg,
- unsigned int tree_depth_arg,
+ uindex_t tree_depth_arg,
Eigen::Vector3f& min_pt,
Eigen::Vector3f& max_pt) const
{
@@ -930,7 +920,7 @@ template <typename PointT,
typename OctreeT>
double
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- getVoxelSquaredSideLen(unsigned int tree_depth_arg) const
+ getVoxelSquaredSideLen(uindex_t tree_depth_arg) const
{
double side_len;
@@ -951,7 +941,7 @@ template <typename PointT,
typename OctreeT>
double
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
- getVoxelSquaredDiameter(unsigned int tree_depth_arg) const
+ getVoxelSquaredDiameter(uindex_t tree_depth_arg) const
{
// return the squared side length of the voxel cube as a function of the octree depth
return (getVoxelSquaredSideLen(tree_depth_arg) * 3);
@@ -962,13 +952,13 @@ template <typename PointT,
typename LeafContainerT,
typename BranchContainerT,
typename OctreeT>
-int
+pcl::uindex_t
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::
getOccupiedVoxelCentersRecursive(const BranchNode* node_arg,
const OctreeKey& key_arg,
AlignedPointTVector& voxel_center_list_arg) const
{
- int voxel_count = 0;
+ uindex_t voxel_count = 0;
// iterate over all children
for (unsigned char child_idx = 0; child_idx < 8; child_idx++) {
diff --git a/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp b/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp
index 77e83c51..57590745 100644
--- a/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp
+++ b/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp
@@ -37,7 +37,6 @@
#pragma once
-#include <pcl/common/geometry.h>
#include <pcl/common/point_tests.h> // for pcl::isFinite
#include <pcl/console/print.h>
@@ -128,12 +127,9 @@ pcl::octree::OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT>
if (pcl::isFinite(temp)) // Make sure transformed point is finite - if it is not, it
// gets default key
{
- key_arg.x =
- static_cast<unsigned int>((temp.x - this->min_x_) / this->resolution_);
- key_arg.y =
- static_cast<unsigned int>((temp.y - this->min_y_) / this->resolution_);
- key_arg.z =
- static_cast<unsigned int>((temp.z - this->min_z_) / this->resolution_);
+ key_arg.x = static_cast<uindex_t>((temp.x - this->min_x_) / this->resolution_);
+ key_arg.y = static_cast<uindex_t>((temp.y - this->min_y_) / this->resolution_);
+ key_arg.z = static_cast<uindex_t>((temp.z - this->min_z_) / this->resolution_);
}
else {
key_arg = OctreeKey();
@@ -141,12 +137,9 @@ pcl::octree::OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT>
}
else {
// calculate integer key for point coordinates
- key_arg.x =
- static_cast<unsigned int>((point_arg.x - this->min_x_) / this->resolution_);
- key_arg.y =
- static_cast<unsigned int>((point_arg.y - this->min_y_) / this->resolution_);
- key_arg.z =
- static_cast<unsigned int>((point_arg.z - this->min_z_) / this->resolution_);
+ key_arg.x = static_cast<uindex_t>((point_arg.x - this->min_x_) / this->resolution_);
+ key_arg.y = static_cast<uindex_t>((point_arg.y - this->min_y_) / this->resolution_);
+ key_arg.z = static_cast<uindex_t>((point_arg.z - this->min_z_) / this->resolution_);
}
}
@@ -154,11 +147,11 @@ pcl::octree::OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT>
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
void
pcl::octree::OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT>::
- addPointIdx(const int pointIdx_arg)
+ addPointIdx(const uindex_t pointIdx_arg)
{
OctreeKey key;
- assert(pointIdx_arg < static_cast<int>(this->input_->size()));
+ assert(pointIdx_arg < this->input_->size());
const PointT& point = (*this->input_)[pointIdx_arg];
if (!pcl::isFinite(point))
@@ -295,13 +288,13 @@ pcl::octree::OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT>
direction.normalize();
float precision = 1.0f;
const float step_size = static_cast<const float>(resolution_) * precision;
- const int nsteps = std::max(1, static_cast<int>(norm / step_size));
+ const auto nsteps = std::max<std::size_t>(1, norm / step_size);
OctreeKey prev_key = key;
// Walk along the line segment with small steps.
Eigen::Vector3f p = leaf_centroid;
PointT octree_p;
- for (int i = 0; i < nsteps; ++i) {
+ for (std::size_t i = 0; i < nsteps; ++i) {
// Start at the leaf voxel, and move back towards sensor.
p += (direction * step_size);
diff --git a/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp b/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp
index ed3f132f..f5e6e889 100644
--- a/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp
+++ b/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp
@@ -70,7 +70,7 @@ pcl::octree::OctreePointCloudVoxelCentroid<PointT, LeafContainerT, BranchContain
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-std::size_t
+pcl::uindex_t
pcl::octree::OctreePointCloudVoxelCentroid<PointT, LeafContainerT, BranchContainerT>::
getVoxelCentroids(
typename OctreePointCloud<PointT, LeafContainerT, BranchContainerT>::
diff --git a/octree/include/pcl/octree/impl/octree_search.hpp b/octree/include/pcl/octree/impl/octree_search.hpp
index 16b98ce0..548b97fc 100644
--- a/octree/include/pcl/octree/impl/octree_search.hpp
+++ b/octree/include/pcl/octree/impl/octree_search.hpp
@@ -48,7 +48,7 @@ namespace octree {
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
bool
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::voxelSearch(
- const PointT& point, std::vector<int>& point_idx_data)
+ const PointT& point, Indices& point_idx_data)
{
assert(isFinite(point) &&
"Invalid (NaN, Inf) point coordinates given to nearestKSearch!");
@@ -71,18 +71,18 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::voxelSearch(
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
bool
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::voxelSearch(
- const int index, std::vector<int>& point_idx_data)
+ const uindex_t index, Indices& point_idx_data)
{
const PointT search_point = this->getPointByIndex(index);
return (this->voxelSearch(search_point, point_idx_data));
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::nearestKSearch(
const PointT& p_q,
- int k,
- std::vector<int>& k_indices,
+ uindex_t k,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances)
{
assert(this->leaf_count_ > 0);
@@ -107,23 +107,23 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::nearestKSearch
getKNearestNeighborRecursive(
p_q, k, this->root_node_, key, 1, smallest_dist, point_candidates);
- unsigned int result_count = static_cast<unsigned int>(point_candidates.size());
+ const auto result_count = static_cast<uindex_t>(point_candidates.size());
k_indices.resize(result_count);
k_sqr_distances.resize(result_count);
- for (unsigned int i = 0; i < result_count; ++i) {
+ for (uindex_t i = 0; i < result_count; ++i) {
k_indices[i] = point_candidates[i].point_idx_;
k_sqr_distances[i] = point_candidates[i].point_distance_;
}
- return static_cast<int>(k_indices.size());
+ return k_indices.size();
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::nearestKSearch(
- int index, int k, std::vector<int>& k_indices, std::vector<float>& k_sqr_distances)
+ uindex_t index, uindex_t k, Indices& k_indices, std::vector<float>& k_sqr_distances)
{
const PointT search_point = this->getPointByIndex(index);
return (nearestKSearch(search_point, k, k_indices, k_sqr_distances));
@@ -132,7 +132,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::nearestKSearch
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
void
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::approxNearestSearch(
- const PointT& p_q, int& result_index, float& sqr_distance)
+ const PointT& p_q, index_t& result_index, float& sqr_distance)
{
assert(this->leaf_count_ > 0);
assert(isFinite(p_q) &&
@@ -150,7 +150,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::approxNearestS
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
void
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::approxNearestSearch(
- int query_index, int& result_index, float& sqr_distance)
+ uindex_t query_index, index_t& result_index, float& sqr_distance)
{
const PointT search_point = this->getPointByIndex(query_index);
@@ -158,13 +158,13 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::approxNearestS
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::radiusSearch(
const PointT& p_q,
const double radius,
- std::vector<int>& k_indices,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn) const
+ uindex_t max_nn) const
{
assert(isFinite(p_q) &&
"Invalid (NaN, Inf) point coordinates given to nearestKSearch!");
@@ -183,17 +183,17 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::radiusSearch(
k_sqr_distances,
max_nn);
- return (static_cast<int>(k_indices.size()));
+ return k_indices.size();
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::radiusSearch(
- int index,
+ uindex_t index,
const double radius,
- std::vector<int>& k_indices,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn) const
+ uindex_t max_nn) const
{
const PointT search_point = this->getPointByIndex(index);
@@ -201,11 +201,11 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::radiusSearch(
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearch(
const Eigen::Vector3f& min_pt,
const Eigen::Vector3f& max_pt,
- std::vector<int>& k_indices) const
+ Indices& k_indices) const
{
OctreeKey key;
@@ -215,7 +215,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearch(
boxSearchRecursive(min_pt, max_pt, this->root_node_, key, 1, k_indices);
- return (static_cast<int>(k_indices.size()));
+ return k_indices.size();
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
@@ -223,10 +223,10 @@ double
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
getKNearestNeighborRecursive(
const PointT& point,
- unsigned int K,
+ uindex_t K,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
+ uindex_t tree_depth,
const double squared_search_radius,
std::vector<prioPointQueueEntry>& point_candidates) const
{
@@ -277,7 +277,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
child_node = search_heap.back().node;
new_key = search_heap.back().key;
- if (tree_depth < this->octree_depth_) {
+ if (child_node->getNodeType() == BRANCH_NODE) {
// we have not reached maximum tree depth
smallest_squared_dist =
getKNearestNeighborRecursive(point,
@@ -290,7 +290,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
else {
// we reached leaf node level
- std::vector<int> decoded_point_vector;
+ Indices decoded_point_vector;
const LeafNode* child_leaf = static_cast<const LeafNode*>(child_node);
@@ -298,7 +298,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
(*child_leaf)->getPointIndices(decoded_point_vector);
// Linearly iterate over all decoded (unsorted) points
- for (const int& point_index : decoded_point_vector) {
+ for (const auto& point_index : decoded_point_vector) {
const PointT& candidate_point = this->getPointByIndex(point_index);
@@ -337,10 +337,10 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
const double radiusSquared,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
- std::vector<int>& k_indices,
+ uindex_t tree_depth,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn) const
+ uindex_t max_nn) const
{
// get spatial voxel information
double voxel_squared_diameter = this->getVoxelSquaredDiameter(tree_depth);
@@ -373,7 +373,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
voxel_squared_diameter / 4.0 + radiusSquared +
sqrt(voxel_squared_diameter * radiusSquared)) {
- if (tree_depth < this->octree_depth_) {
+ if (child_node->getNodeType() == BRANCH_NODE) {
// we have not reached maximum tree depth
getNeighborsWithinRadiusRecursive(point,
radiusSquared,
@@ -383,19 +383,19 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
k_indices,
k_sqr_distances,
max_nn);
- if (max_nn != 0 && k_indices.size() == static_cast<unsigned int>(max_nn))
+ if (max_nn != 0 && k_indices.size() == max_nn)
return;
}
else {
// we reached leaf node level
const LeafNode* child_leaf = static_cast<const LeafNode*>(child_node);
- std::vector<int> decoded_point_vector;
+ Indices decoded_point_vector;
// decode leaf node into decoded_point_vector
(*child_leaf)->getPointIndices(decoded_point_vector);
// Linearly iterate over all decoded (unsorted) points
- for (const int& index : decoded_point_vector) {
+ for (const auto& index : decoded_point_vector) {
const PointT& candidate_point = this->getPointByIndex(index);
// calculate point distance to search point
@@ -409,7 +409,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
k_indices.push_back(index);
k_sqr_distances.push_back(squared_dist);
- if (max_nn != 0 && k_indices.size() == static_cast<unsigned int>(max_nn))
+ if (max_nn != 0 && k_indices.size() == max_nn)
return;
}
}
@@ -423,8 +423,8 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
approxNearestSearchRecursive(const PointT& point,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
- int& result_index,
+ uindex_t tree_depth,
+ index_t& result_index,
float& sqr_distance)
{
OctreeKey minChildKey;
@@ -468,7 +468,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
child_node = this->getBranchChildPtr(*node, min_child_idx);
- if (tree_depth < this->octree_depth_) {
+ if (child_node->getNodeType() == BRANCH_NODE) {
// we have not reached maximum tree depth
approxNearestSearchRecursive(point,
static_cast<const BranchNode*>(child_node),
@@ -479,21 +479,21 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
else {
// we reached leaf node level
- std::vector<int> decoded_point_vector;
+ Indices decoded_point_vector;
const LeafNode* child_leaf = static_cast<const LeafNode*>(child_node);
- double smallest_squared_dist = std::numeric_limits<double>::max();
+ float smallest_squared_dist = std::numeric_limits<float>::max();
// decode leaf node into decoded_point_vector
(**child_leaf).getPointIndices(decoded_point_vector);
// Linearly iterate over all decoded (unsorted) points
- for (const int& index : decoded_point_vector) {
+ for (const auto& index : decoded_point_vector) {
const PointT& candidate_point = this->getPointByIndex(index);
// calculate point distance to search point
- double squared_dist = pointSquaredDist(candidate_point, point);
+ float squared_dist = pointSquaredDist(candidate_point, point);
// check if a closer match is found
if (squared_dist >= smallest_squared_dist)
@@ -501,7 +501,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
result_index = index;
smallest_squared_dist = squared_dist;
- sqr_distance = static_cast<float>(squared_dist);
+ sqr_distance = squared_dist;
}
}
}
@@ -521,8 +521,8 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearchRecur
const Eigen::Vector3f& max_pt,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
- std::vector<int>& k_indices) const
+ uindex_t tree_depth,
+ Indices& k_indices) const
{
// iterate over all children
for (unsigned char child_idx = 0; child_idx < 8; child_idx++) {
@@ -552,7 +552,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearchRecur
(lower_voxel_corner(1) > max_pt(1)) || (min_pt(1) > upper_voxel_corner(1)) ||
(lower_voxel_corner(2) > max_pt(2)) || (min_pt(2) > upper_voxel_corner(2)))) {
- if (tree_depth < this->octree_depth_) {
+ if (child_node->getNodeType() == BRANCH_NODE) {
// we have not reached maximum tree depth
boxSearchRecursive(min_pt,
max_pt,
@@ -563,7 +563,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearchRecur
}
else {
// we reached leaf node level
- std::vector<int> decoded_point_vector;
+ Indices decoded_point_vector;
const LeafNode* child_leaf = static_cast<const LeafNode*>(child_node);
@@ -571,7 +571,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearchRecur
(**child_leaf).getPointIndices(decoded_point_vector);
// Linearly iterate over all decoded (unsorted) points
- for (const int& index : decoded_point_vector) {
+ for (const auto& index : decoded_point_vector) {
const PointT& candidate_point = this->getPointByIndex(index);
// check if point falls within search box
@@ -590,12 +590,12 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::boxSearchRecur
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
getIntersectedVoxelCenters(Eigen::Vector3f origin,
Eigen::Vector3f direction,
AlignedPointTVector& voxel_center_list,
- int max_voxel_count) const
+ uindex_t max_voxel_count) const
{
OctreeKey key;
key.x = key.y = key.z = 0;
@@ -626,12 +626,12 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
getIntersectedVoxelIndices(Eigen::Vector3f origin,
Eigen::Vector3f direction,
- std::vector<int>& k_indices,
- int max_voxel_count) const
+ Indices& k_indices,
+ uindex_t max_voxel_count) const
{
OctreeKey key;
key.x = key.y = key.z = 0;
@@ -660,7 +660,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
getIntersectedVoxelCentersRecursive(double min_x,
double min_y,
@@ -672,7 +672,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
const OctreeNode* node,
const OctreeKey& key,
AlignedPointTVector& voxel_center_list,
- int max_voxel_count) const
+ uindex_t max_voxel_count) const
{
if (max_x < 0.0 || max_y < 0.0 || max_z < 0.0)
return (0);
@@ -689,7 +689,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
// Voxel intersection count for branches children
- int voxel_count = 0;
+ uindex_t voxel_count = 0;
// Voxel mid lines
double mid_x = 0.5 * (min_x + max_x);
@@ -697,7 +697,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
double mid_z = 0.5 * (min_z + max_z);
// First voxel node ray will intersect
- int curr_node = getFirstIntersectedNode(min_x, min_y, min_z, mid_x, mid_y, mid_z);
+ auto curr_node = getFirstIntersectedNode(min_x, min_y, min_z, mid_x, mid_y, mid_z);
// Child index, node and key
unsigned char child_idx;
@@ -856,7 +856,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
template <typename PointT, typename LeafContainerT, typename BranchContainerT>
-int
+uindex_t
OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
getIntersectedVoxelIndicesRecursive(double min_x,
double min_y,
@@ -867,8 +867,8 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
unsigned char a,
const OctreeNode* node,
const OctreeKey& key,
- std::vector<int>& k_indices,
- int max_voxel_count) const
+ Indices& k_indices,
+ uindex_t max_voxel_count) const
{
if (max_x < 0.0 || max_y < 0.0 || max_z < 0.0)
return (0);
@@ -884,7 +884,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
}
// Voxel intersection count for branches children
- int voxel_count = 0;
+ uindex_t voxel_count = 0;
// Voxel mid lines
double mid_x = 0.5 * (min_x + max_x);
@@ -892,7 +892,7 @@ OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::
double mid_z = 0.5 * (min_z + max_z);
// First voxel node ray will intersect
- int curr_node = getFirstIntersectedNode(min_x, min_y, min_z, mid_x, mid_y, mid_z);
+ auto curr_node = getFirstIntersectedNode(min_x, min_y, min_z, mid_x, mid_y, mid_z);
// Child index, node and key
unsigned char child_idx;
diff --git a/octree/include/pcl/octree/octree2buf_base.h b/octree/include/pcl/octree/octree2buf_base.h
index 6d9e70ee..6554e705 100644
--- a/octree/include/pcl/octree/octree2buf_base.h
+++ b/octree/include/pcl/octree/octree2buf_base.h
@@ -212,7 +212,7 @@ protected:
* \ingroup octree
* \author Julius Kammerl (julius@kammerl.de)
*/
-template <typename LeafContainerT = int,
+template <typename LeafContainerT = index_t,
typename BranchContainerT = OctreeContainerEmpty>
class Octree2BufBase {
@@ -236,7 +236,7 @@ public:
using Iterator = OctreeDepthFirstIterator<OctreeT>;
using ConstIterator = const OctreeDepthFirstIterator<OctreeT>;
Iterator
- begin(unsigned int max_depth_arg = 0)
+ begin(uindex_t max_depth_arg = 0)
{
return Iterator(this, max_depth_arg);
};
@@ -253,26 +253,12 @@ public:
using LeafNodeIterator = OctreeLeafNodeDepthFirstIterator<OctreeT>;
using ConstLeafNodeIterator = const OctreeLeafNodeDepthFirstIterator<OctreeT>;
- PCL_DEPRECATED(1, 12, "use leaf_depth_begin() instead")
- LeafNodeIterator
- leaf_begin(unsigned int max_depth_arg = 0)
- {
- return LeafNodeIterator(this, max_depth_arg);
- };
-
- PCL_DEPRECATED(1, 12, "use leaf_depth_end() instead")
- const LeafNodeIterator
- leaf_end()
- {
- return LeafNodeIterator();
- };
-
// The currently valide names
using LeafNodeDepthFirstIterator = OctreeLeafNodeDepthFirstIterator<OctreeT>;
using ConstLeafNodeDepthFirstIterator =
const OctreeLeafNodeDepthFirstIterator<OctreeT>;
LeafNodeDepthFirstIterator
- leaf_depth_begin(unsigned int max_depth_arg = 0)
+ leaf_depth_begin(uindex_t max_depth_arg = 0)
{
return LeafNodeDepthFirstIterator(this, max_depth_arg);
};
@@ -287,7 +273,7 @@ public:
using DepthFirstIterator = OctreeDepthFirstIterator<OctreeT>;
using ConstDepthFirstIterator = const OctreeDepthFirstIterator<OctreeT>;
DepthFirstIterator
- depth_begin(unsigned int maxDepth_arg = 0)
+ depth_begin(uindex_t maxDepth_arg = 0)
{
return DepthFirstIterator(this, maxDepth_arg);
};
@@ -301,7 +287,7 @@ public:
using BreadthFirstIterator = OctreeBreadthFirstIterator<OctreeT>;
using ConstBreadthFirstIterator = const OctreeBreadthFirstIterator<OctreeT>;
BreadthFirstIterator
- breadth_begin(unsigned int max_depth_arg = 0)
+ breadth_begin(uindex_t max_depth_arg = 0)
{
return BreadthFirstIterator(this, max_depth_arg);
};
@@ -317,7 +303,7 @@ public:
const OctreeLeafNodeBreadthFirstIterator<OctreeT>;
LeafNodeBreadthIterator
- leaf_breadth_begin(unsigned int max_depth_arg = 0u)
+ leaf_breadth_begin(uindex_t max_depth_arg = 0u)
{
return LeafNodeBreadthIterator(this,
max_depth_arg ? max_depth_arg : this->octree_depth_);
@@ -368,18 +354,18 @@ public:
* \param max_voxel_index_arg: maximum amount of voxels per dimension
*/
void
- setMaxVoxelIndex(unsigned int max_voxel_index_arg);
+ setMaxVoxelIndex(uindex_t max_voxel_index_arg);
/** \brief Set the maximum depth of the octree.
* \param depth_arg: maximum depth of octree
*/
void
- setTreeDepth(unsigned int depth_arg);
+ setTreeDepth(uindex_t depth_arg);
/** \brief Get the maximum depth of the octree.
* \return depth_arg: maximum depth of octree
*/
- inline unsigned int
+ inline uindex_t
getTreeDepth() const
{
return this->octree_depth_;
@@ -393,7 +379,7 @@ public:
* \return pointer to new leaf node container.
*/
LeafContainerT*
- createLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg);
+ createLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg);
/** \brief Find leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
* \note If leaf node already exist, this method returns the existing node
@@ -403,7 +389,7 @@ public:
* \return pointer to leaf node container if found, null pointer otherwise.
*/
LeafContainerT*
- findLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg);
+ findLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg);
/** \brief Check for the existence of leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
* \param idx_x_arg: index of leaf node in the X axis.
@@ -412,9 +398,7 @@ public:
* \return "true" if leaf node search is successful, otherwise it returns "false".
*/
bool
- existLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg) const;
+ existLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg) const;
/** \brief Remove leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
* \param idx_x_arg: index of leaf node in the X axis.
@@ -422,7 +406,7 @@ public:
* \param idx_z_arg: index of leaf node in the Z axis.
*/
void
- removeLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg);
+ removeLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg);
/** \brief Return the amount of existing leafs in the octree.
* \return amount of registered leaf nodes.
@@ -839,9 +823,9 @@ protected:
* \param branch_reset_arg: Reset pointer array of current branch
* \return depth mask at which leaf node was created/found
**/
- unsigned int
+ uindex_t
createLeafRecursive(const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafNode*& return_leaf_arg,
BranchNode*& parent_of_leaf_arg,
@@ -857,7 +841,7 @@ protected:
**/
void
findLeafRecursive(const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafContainerT*& result_arg) const;
@@ -871,7 +855,7 @@ protected:
**/
bool
deleteLeafRecursive(const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg);
/** \brief Recursively explore the octree and output binary octree description
@@ -915,7 +899,7 @@ protected:
void
deserializeTreeRecursive(
BranchNode* branch_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
OctreeKey& key_arg,
typename std::vector<char>::const_iterator& binary_tree_in_it_arg,
typename std::vector<char>::const_iterator& binary_tree_in_it_end_arg,
@@ -952,15 +936,6 @@ protected:
void
treeCleanUpRecursive(BranchNode* branch_arg);
- /** \brief Helper function to calculate the binary logarithm
- * \param n_arg: some value
- * \return binary logarithm (log2) of argument n_arg
- */
- PCL_DEPRECATED(1, 12, "use std::log2 instead") inline double Log2(double n_arg)
- {
- return std::log2(n_arg);
- }
-
/** \brief Test if octree is able to dynamically change its depth. This is required
* for adaptive bounding box adjustment.
* \return "false" - not resizeable due to XOR serialization
@@ -1001,7 +976,7 @@ protected:
BranchNode* root_node_;
/** \brief Depth mask based on octree depth **/
- unsigned int depth_mask_;
+ uindex_t depth_mask_;
/** \brief key range */
OctreeKey max_key_;
@@ -1009,11 +984,12 @@ protected:
/** \brief Currently active octree buffer **/
unsigned char buffer_selector_;
- // flags indicating if unused branches and leafs might exist in previous buffer
+ /** \brief flags indicating if unused branches and leafs might exist in previous
+ * buffer **/
bool tree_dirty_flag_;
/** \brief Octree depth */
- unsigned int octree_depth_;
+ uindex_t octree_depth_;
/** \brief Enable dynamic_depth
* \note Note that this parameter is ignored in octree2buf! */
diff --git a/octree/include/pcl/octree/octree_base.h b/octree/include/pcl/octree/octree_base.h
index c487b924..5201f64d 100644
--- a/octree/include/pcl/octree/octree_base.h
+++ b/octree/include/pcl/octree/octree_base.h
@@ -57,7 +57,7 @@ namespace octree {
* \ingroup octree
* \author Julius Kammerl (julius@kammerl.de)
*/
-template <typename LeafContainerT = int,
+template <typename LeafContainerT = index_t,
typename BranchContainerT = OctreeContainerEmpty>
class OctreeBase {
public:
@@ -84,10 +84,10 @@ protected:
BranchNode* root_node_;
/** \brief Depth mask based on octree depth **/
- unsigned int depth_mask_;
+ uindex_t depth_mask_;
/** \brief Octree depth */
- unsigned int octree_depth_;
+ uindex_t octree_depth_;
/** \brief Enable dynamic_depth **/
bool dynamic_depth_enabled_;
@@ -109,7 +109,7 @@ public:
using ConstIterator = const OctreeDepthFirstIterator<OctreeT>;
Iterator
- begin(unsigned int max_depth_arg = 0u)
+ begin(uindex_t max_depth_arg = 0u)
{
return Iterator(this, max_depth_arg ? max_depth_arg : this->octree_depth_);
};
@@ -127,27 +127,13 @@ public:
using LeafNodeIterator = OctreeLeafNodeDepthFirstIterator<OctreeT>;
using ConstLeafNodeIterator = const OctreeLeafNodeDepthFirstIterator<OctreeT>;
- PCL_DEPRECATED(1, 12, "use leaf_depth_begin() instead")
- LeafNodeIterator
- leaf_begin(unsigned int max_depth_arg = 0u)
- {
- return LeafNodeIterator(this, max_depth_arg ? max_depth_arg : this->octree_depth_);
- };
-
- PCL_DEPRECATED(1, 12, "use leaf_depth_end() instead")
- const LeafNodeIterator
- leaf_end()
- {
- return LeafNodeIterator(this, 0, nullptr);
- };
-
// The currently valide names
using LeafNodeDepthFirstIterator = OctreeLeafNodeDepthFirstIterator<OctreeT>;
using ConstLeafNodeDepthFirstIterator =
const OctreeLeafNodeDepthFirstIterator<OctreeT>;
LeafNodeDepthFirstIterator
- leaf_depth_begin(unsigned int max_depth_arg = 0u)
+ leaf_depth_begin(uindex_t max_depth_arg = 0u)
{
return LeafNodeDepthFirstIterator(
this, max_depth_arg ? max_depth_arg : this->octree_depth_);
@@ -164,7 +150,7 @@ public:
using ConstDepthFirstIterator = const OctreeDepthFirstIterator<OctreeT>;
DepthFirstIterator
- depth_begin(unsigned int max_depth_arg = 0u)
+ depth_begin(uindex_t max_depth_arg = 0u)
{
return DepthFirstIterator(this,
max_depth_arg ? max_depth_arg : this->octree_depth_);
@@ -181,7 +167,7 @@ public:
using ConstBreadthFirstIterator = const OctreeBreadthFirstIterator<OctreeT>;
BreadthFirstIterator
- breadth_begin(unsigned int max_depth_arg = 0u)
+ breadth_begin(uindex_t max_depth_arg = 0u)
{
return BreadthFirstIterator(this,
max_depth_arg ? max_depth_arg : this->octree_depth_);
@@ -198,7 +184,7 @@ public:
using ConstFixedDepthIterator = const OctreeFixedDepthIterator<OctreeT>;
FixedDepthIterator
- fixed_depth_begin(unsigned int fixed_depth_arg = 0u)
+ fixed_depth_begin(uindex_t fixed_depth_arg = 0u)
{
return FixedDepthIterator(this, fixed_depth_arg);
};
@@ -215,7 +201,7 @@ public:
const OctreeLeafNodeBreadthFirstIterator<OctreeT>;
LeafNodeBreadthFirstIterator
- leaf_breadth_begin(unsigned int max_depth_arg = 0u)
+ leaf_breadth_begin(uindex_t max_depth_arg = 0u)
{
return LeafNodeBreadthFirstIterator(
this, max_depth_arg ? max_depth_arg : this->octree_depth_);
@@ -263,18 +249,18 @@ public:
* \param[in] max_voxel_index_arg maximum amount of voxels per dimension
*/
void
- setMaxVoxelIndex(unsigned int max_voxel_index_arg);
+ setMaxVoxelIndex(uindex_t max_voxel_index_arg);
/** \brief Set the maximum depth of the octree.
* \param max_depth_arg: maximum depth of octree
*/
void
- setTreeDepth(unsigned int max_depth_arg);
+ setTreeDepth(uindex_t max_depth_arg);
/** \brief Get the maximum depth of the octree.
* \return depth_arg: maximum depth of octree
*/
- unsigned int
+ uindex_t
getTreeDepth() const
{
return this->octree_depth_;
@@ -288,7 +274,7 @@ public:
* \return pointer to new leaf node container.
*/
LeafContainerT*
- createLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg);
+ createLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg);
/** \brief Find leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
* \note If leaf node already exist, this method returns the existing node
@@ -298,7 +284,7 @@ public:
* \return pointer to leaf node container if found, null pointer otherwise.
*/
LeafContainerT*
- findLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg);
+ findLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg);
/** \brief idx_x_arg for the existence of leaf node at (idx_x_arg, idx_y_arg,
* idx_z_arg).
@@ -308,9 +294,7 @@ public:
* \return "true" if leaf node search is successful, otherwise it returns "false".
*/
bool
- existLeaf(unsigned int idx_x_arg,
- unsigned int idx_y_arg,
- unsigned int idx_z_arg) const;
+ existLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg) const;
/** \brief Remove leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
* \param idx_x_arg: index of leaf node in the X axis.
@@ -318,7 +302,7 @@ public:
* \param idx_z_arg: index of leaf node in the Z axis.
*/
void
- removeLeaf(unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg);
+ removeLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg);
/** \brief Return the amount of existing leafs in the octree.
* \return amount of registered leaf nodes.
@@ -594,9 +578,9 @@ protected:
* \param parent_of_leaf_arg: return pointer to parent of leaf node
* \return depth mask at which leaf node was created
**/
- unsigned int
+ uindex_t
createLeafRecursive(const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafNode*& return_leaf_arg,
BranchNode*& parent_of_leaf_arg);
@@ -611,7 +595,7 @@ protected:
**/
void
findLeafRecursive(const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg,
LeafContainerT*& result_arg) const;
@@ -625,7 +609,7 @@ protected:
**/
bool
deleteLeafRecursive(const OctreeKey& key_arg,
- unsigned int depth_mask_arg,
+ uindex_t depth_mask_arg,
BranchNode* branch_arg);
/** \brief Recursively explore the octree and output binary octree description
@@ -658,7 +642,7 @@ protected:
void
deserializeTreeRecursive(
BranchNode* branch_arg,
- unsigned int depth_mask_arg,
+ uindex_t 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,
@@ -687,15 +671,6 @@ protected:
// Helpers
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /** \brief Helper function to calculate the binary logarithm
- * \param n_arg: some value
- * \return binary logarithm (log2) of argument n_arg
- */
- PCL_DEPRECATED(1, 12, "use std::log2 instead") double Log2(double n_arg)
- {
- return std::log2(n_arg);
- }
-
/** \brief Test if octree is able to dynamically change its depth. This is required
*for adaptive bounding box adjustment.
* \return "true"
diff --git a/octree/include/pcl/octree/octree_container.h b/octree/include/pcl/octree/octree_container.h
index c4655b7c..f520cbcd 100644
--- a/octree/include/pcl/octree/octree_container.h
+++ b/octree/include/pcl/octree/octree_container.h
@@ -38,6 +38,8 @@
#pragma once
+#include <pcl/types.h>
+
#include <cassert>
#include <cstddef>
#include <vector>
@@ -74,7 +76,7 @@ public:
/** \brief Pure abstract method to get size of container (number of indices)
* \return number of points/indices stored in leaf node container.
*/
- virtual std::size_t
+ virtual uindex_t
getSize() const
{
return 0u;
@@ -88,21 +90,21 @@ public:
* indices.
*/
void
- addPointIndex(const int&)
+ addPointIndex(const index_t&)
{}
/** \brief Empty getPointIndex implementation as this leaf node does not store any
* point indices.
*/
void
- getPointIndex(int&) const
+ getPointIndex(index_t&) const
{}
/** \brief Empty getPointIndices implementation as this leaf node does not store any
* data. \
*/
void
- getPointIndices(std::vector<int>&) const
+ getPointIndices(Indices&) const
{}
};
@@ -125,7 +127,7 @@ public:
/** \brief Abstract get size of container (number of DataT objects)
* \return number of DataT elements in leaf node container.
*/
- std::size_t
+ uindex_t
getSize() const override
{
return 0;
@@ -139,14 +141,12 @@ public:
/** \brief Empty addPointIndex implementation. This leaf node does not store any point
* indices.
*/
- void
- addPointIndex(int)
- {}
+ void addPointIndex(index_t) {}
/** \brief Empty getPointIndex implementation as this leaf node does not store any
* point indices.
*/
- int
+ index_t
getPointIndex() const
{
assert("getPointIndex: undefined point index");
@@ -157,7 +157,7 @@ public:
* data.
*/
void
- getPointIndices(std::vector<int>&) const
+ getPointIndices(Indices&) const
{}
};
@@ -195,7 +195,7 @@ public:
* \param[in] data_arg index to be stored within leaf node.
*/
void
- addPointIndex(int data_arg)
+ addPointIndex(index_t data_arg)
{
data_ = data_arg;
}
@@ -204,7 +204,7 @@ public:
* point index
* \return index stored within container.
*/
- int
+ index_t
getPointIndex() const
{
return data_;
@@ -216,31 +216,31 @@ public:
* data vector
*/
void
- getPointIndices(std::vector<int>& data_vector_arg) const
+ getPointIndices(Indices& data_vector_arg) const
{
- if (data_ >= 0)
+ if (data_ != static_cast<index_t>(-1))
data_vector_arg.push_back(data_);
}
/** \brief Get size of container (number of DataT objects)
* \return number of DataT elements in leaf node container.
*/
- std::size_t
+ uindex_t
getSize() const override
{
- return data_ < 0 ? 0 : 1;
+ return data_ != static_cast<index_t>(-1) ? 0 : 1;
}
/** \brief Reset leaf node memory to zero. */
void
reset() override
{
- data_ = -1;
+ data_ = static_cast<index_t>(-1);
}
protected:
/** \brief Point index stored in octree. */
- int data_;
+ index_t data_;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -274,7 +274,7 @@ public:
* \param[in] data_arg index to be stored within leaf node.
*/
void
- addPointIndex(int data_arg)
+ addPointIndex(index_t data_arg)
{
leafDataTVector_.push_back(data_arg);
}
@@ -283,7 +283,7 @@ public:
* point indices.
* \return index stored within container.
*/
- int
+ index_t
getPointIndex() const
{
return leafDataTVector_.back();
@@ -295,7 +295,7 @@ public:
* within data vector
*/
void
- getPointIndices(std::vector<int>& data_vector_arg) const
+ getPointIndices(Indices& data_vector_arg) const
{
data_vector_arg.insert(
data_vector_arg.end(), leafDataTVector_.begin(), leafDataTVector_.end());
@@ -305,7 +305,7 @@ public:
* of point indices.
* \return reference to vector of point indices to be stored within data vector
*/
- std::vector<int>&
+ Indices&
getPointIndicesVector()
{
return leafDataTVector_;
@@ -314,10 +314,10 @@ public:
/** \brief Get size of container (number of indices)
* \return number of point indices in container.
*/
- std::size_t
+ uindex_t
getSize() const override
{
- return leafDataTVector_.size();
+ return static_cast<uindex_t>(leafDataTVector_.size());
}
/** \brief Reset leaf node. Clear DataT vector.*/
@@ -329,7 +329,7 @@ public:
protected:
/** \brief Leaf node DataT vector. */
- std::vector<int> leafDataTVector_;
+ Indices leafDataTVector_;
};
} // namespace octree
diff --git a/octree/include/pcl/octree/octree_iterator.h b/octree/include/pcl/octree/octree_iterator.h
index 2156b327..2c1a848d 100644
--- a/octree/include/pcl/octree/octree_iterator.h
+++ b/octree/include/pcl/octree/octree_iterator.h
@@ -59,7 +59,7 @@ namespace octree {
struct IteratorState {
OctreeNode* node_;
OctreeKey key_;
- unsigned int depth_;
+ uindex_t depth_;
};
/** \brief @b Abstract octree iterator class
@@ -82,8 +82,13 @@ public:
/** \brief Empty constructor.
*/
- explicit OctreeIteratorBase(unsigned int max_depth_arg = 0)
- : octree_(0), current_state_(0), max_octree_depth_(max_depth_arg)
+ OctreeIteratorBase() : OctreeIteratorBase(nullptr, 0u) {}
+
+ /** \brief Constructor.
+ * \param[in] max_depth_arg Depth limitation during traversal
+ */
+ explicit OctreeIteratorBase(uindex_t max_depth_arg)
+ : octree_(nullptr), current_state_(nullptr), max_octree_depth_(max_depth_arg)
{
this->reset();
}
@@ -93,7 +98,14 @@ public:
* root node.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeIteratorBase(OctreeT* octree_arg, unsigned int max_depth_arg = 0)
+ OctreeIteratorBase(OctreeT* octree_arg) : OctreeIteratorBase(octree_arg, 0u) {}
+
+ /** \brief Constructor.
+ * \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
+ * root node.
+ * \param[in] max_depth_arg Depth limitation during traversal
+ */
+ explicit OctreeIteratorBase(OctreeT* octree_arg, uindex_t max_depth_arg)
: octree_(octree_arg), current_state_(0), max_octree_depth_(max_depth_arg)
{
this->reset();
@@ -108,7 +120,7 @@ public:
* \warning For advanced users only.
*/
explicit OctreeIteratorBase(OctreeT* octree_arg,
- unsigned int max_depth_arg,
+ uindex_t max_depth_arg,
IteratorState* current_state)
: octree_(octree_arg), current_state_(current_state), max_octree_depth_(max_depth_arg)
{}
@@ -169,7 +181,7 @@ public:
/** \brief Get the current depth level of octree
* \return depth level
*/
- inline unsigned int
+ inline uindex_t
getCurrentOctreeDepth() const
{
assert(octree_ != 0);
@@ -327,7 +339,7 @@ public:
if (current_state_) {
const OctreeKey& key = getCurrentOctreeKey();
// calculate integer id with respect to octree key
- unsigned int depth = octree_->getTreeDepth();
+ uindex_t depth = octree_->getTreeDepth();
id = static_cast<unsigned long>(key.x) << (depth * 2) |
static_cast<unsigned long>(key.y) << (depth * 1) |
static_cast<unsigned long>(key.z) << (depth * 0);
@@ -344,7 +356,7 @@ protected:
IteratorState* current_state_;
/** \brief Maximum octree depth */
- unsigned int max_octree_depth_;
+ uindex_t max_octree_depth_;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -364,15 +376,14 @@ public:
/** \brief Empty constructor.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeDepthFirstIterator(unsigned int max_depth_arg = 0);
+ explicit OctreeDepthFirstIterator(uindex_t max_depth_arg = 0);
/** \brief Constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
* root node.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeDepthFirstIterator(OctreeT* octree_arg,
- unsigned int max_depth_arg = 0);
+ explicit OctreeDepthFirstIterator(OctreeT* octree_arg, uindex_t max_depth_arg = 0);
/** \brief Constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
@@ -384,7 +395,7 @@ public:
*/
explicit OctreeDepthFirstIterator(
OctreeT* octree_arg,
- unsigned int max_depth_arg,
+ uindex_t max_depth_arg,
IteratorState* current_state,
const std::vector<IteratorState>& stack = std::vector<IteratorState>())
: OctreeIteratorBase<OctreeT>(octree_arg, max_depth_arg, current_state), stack_(stack)
@@ -469,15 +480,14 @@ public:
/** \brief Empty constructor.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeBreadthFirstIterator(unsigned int max_depth_arg = 0);
+ explicit OctreeBreadthFirstIterator(uindex_t max_depth_arg = 0);
/** \brief Constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
* root node.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeBreadthFirstIterator(OctreeT* octree_arg,
- unsigned int max_depth_arg = 0);
+ explicit OctreeBreadthFirstIterator(OctreeT* octree_arg, uindex_t max_depth_arg = 0);
/** \brief Constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
@@ -489,7 +499,7 @@ public:
*/
explicit OctreeBreadthFirstIterator(
OctreeT* octree_arg,
- unsigned int max_depth_arg,
+ uindex_t max_depth_arg,
IteratorState* current_state,
const std::deque<IteratorState>& fifo = std::deque<IteratorState>())
: OctreeIteratorBase<OctreeT>(octree_arg, max_depth_arg, current_state), FIFO_(fifo)
@@ -575,8 +585,7 @@ public:
* root node.
* \param[in] fixed_depth_arg Depth level during traversal
*/
- explicit OctreeFixedDepthIterator(OctreeT* octree_arg,
- unsigned int fixed_depth_arg = 0);
+ explicit OctreeFixedDepthIterator(OctreeT* octree_arg, uindex_t fixed_depth_arg = 0);
/** \brief Constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
@@ -589,7 +598,7 @@ public:
*/
OctreeFixedDepthIterator(
OctreeT* octree_arg,
- unsigned int fixed_depth_arg,
+ uindex_t fixed_depth_arg,
IteratorState* current_state,
const std::deque<IteratorState>& fifo = std::deque<IteratorState>())
: OctreeBreadthFirstIterator<OctreeT>(
@@ -623,7 +632,7 @@ public:
* \param[in] fixed_depth_arg Depth level during traversal
*/
void
- reset(unsigned int fixed_depth_arg);
+ reset(uindex_t fixed_depth_arg);
/** \brief Reset the iterator to the first node at the current depth
*/
@@ -637,7 +646,7 @@ protected:
using OctreeBreadthFirstIterator<OctreeT>::FIFO_;
/** \brief Given level of the node to be iterated */
- unsigned int fixed_depth_;
+ uindex_t fixed_depth_;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -657,7 +666,7 @@ public:
/** \brief Empty constructor.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeLeafNodeDepthFirstIterator(unsigned int max_depth_arg = 0)
+ explicit OctreeLeafNodeDepthFirstIterator(uindex_t max_depth_arg = 0)
: OctreeDepthFirstIterator<OctreeT>(max_depth_arg)
{
reset();
@@ -669,7 +678,7 @@ public:
* \param[in] max_depth_arg Depth limitation during traversal
*/
explicit OctreeLeafNodeDepthFirstIterator(OctreeT* octree_arg,
- unsigned int max_depth_arg = 0)
+ uindex_t max_depth_arg = 0)
: OctreeDepthFirstIterator<OctreeT>(octree_arg, max_depth_arg)
{
reset();
@@ -685,7 +694,7 @@ public:
*/
explicit OctreeLeafNodeDepthFirstIterator(
OctreeT* octree_arg,
- unsigned int max_depth_arg,
+ uindex_t max_depth_arg,
IteratorState* current_state,
const std::vector<IteratorState>& stack = std::vector<IteratorState>())
: OctreeDepthFirstIterator<OctreeT>(octree_arg, max_depth_arg, current_state, stack)
@@ -759,7 +768,7 @@ public:
/** \brief Empty constructor.
* \param[in] max_depth_arg Depth limitation during traversal
*/
- explicit OctreeLeafNodeBreadthFirstIterator(unsigned int max_depth_arg = 0);
+ explicit OctreeLeafNodeBreadthFirstIterator(uindex_t max_depth_arg = 0);
/** \brief Constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
@@ -767,7 +776,7 @@ public:
* \param[in] max_depth_arg Depth limitation during traversal
*/
explicit OctreeLeafNodeBreadthFirstIterator(OctreeT* octree_arg,
- unsigned int max_depth_arg = 0);
+ uindex_t max_depth_arg = 0);
/** \brief Copy constructor.
* \param[in] octree_arg Octree to be iterated. Initially the iterator is set to its
@@ -780,7 +789,7 @@ public:
*/
explicit OctreeLeafNodeBreadthFirstIterator(
OctreeT* octree_arg,
- unsigned int max_depth_arg,
+ uindex_t max_depth_arg,
IteratorState* current_state,
const std::deque<IteratorState>& fifo = std::deque<IteratorState>());
diff --git a/octree/include/pcl/octree/octree_key.h b/octree/include/pcl/octree/octree_key.h
index a103d5a3..4e676221 100644
--- a/octree/include/pcl/octree/octree_key.h
+++ b/octree/include/pcl/octree/octree_key.h
@@ -55,9 +55,7 @@ public:
OctreeKey() : x(0), y(0), z(0) {}
/** \brief Constructor for key initialization. */
- OctreeKey(unsigned int keyX, unsigned int keyY, unsigned int keyZ)
- : x(keyX), y(keyY), z(keyZ)
- {}
+ OctreeKey(uindex_t keyX, uindex_t keyY, uindex_t keyZ) : x(keyX), y(keyY), z(keyZ) {}
/** \brief Copy constructor. */
OctreeKey(const OctreeKey& source) { std::memcpy(key_, source.key_, sizeof(key_)); }
@@ -131,7 +129,7 @@ public:
* \return child node index
* */
inline unsigned char
- getChildIdxWithDepthMask(unsigned int depthMask) const
+ getChildIdxWithDepthMask(uindex_t depthMask) const
{
return static_cast<unsigned char>(((!!(this->x & depthMask)) << 2) |
((!!(this->y & depthMask)) << 1) |
@@ -140,17 +138,17 @@ public:
/* \brief maximum depth that can be addressed */
static const unsigned char maxDepth =
- static_cast<unsigned char>(sizeof(std::uint32_t) * 8);
+ static_cast<unsigned char>(sizeof(uindex_t) * 8);
// Indices addressing a voxel at (X, Y, Z)
union {
struct {
- std::uint32_t x;
- std::uint32_t y;
- std::uint32_t z;
+ uindex_t x;
+ uindex_t y;
+ uindex_t z;
};
- std::uint32_t key_[3];
+ uindex_t key_[3];
};
};
} // namespace octree
diff --git a/octree/include/pcl/octree/octree_nodes.h b/octree/include/pcl/octree/octree_nodes.h
index e00182df..b1599a78 100644
--- a/octree/include/pcl/octree/octree_nodes.h
+++ b/octree/include/pcl/octree/octree_nodes.h
@@ -42,10 +42,7 @@
#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
-#include <Eigen/Core>
-
#include <cassert>
-#include <cstddef>
namespace pcl {
namespace octree {
diff --git a/octree/include/pcl/octree/octree_pointcloud.h b/octree/include/pcl/octree/octree_pointcloud.h
index 4f66675c..be4df0fc 100644
--- a/octree/include/pcl/octree/octree_pointcloud.h
+++ b/octree/include/pcl/octree/octree_pointcloud.h
@@ -82,8 +82,8 @@ public:
OctreePointCloud(const double resolution_arg);
// public typedefs
- using IndicesPtr = shared_ptr<std::vector<int>>;
- using IndicesConstPtr = shared_ptr<const std::vector<int>>;
+ using IndicesPtr = shared_ptr<Indices>;
+ using IndicesConstPtr = shared_ptr<const Indices>;
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = typename PointCloud::Ptr;
@@ -183,7 +183,7 @@ public:
/** \brief Get the maximum depth of the octree.
* \return depth_arg: maximum depth of octree
* */
- inline unsigned int
+ inline uindex_t
getTreeDepth() const
{
return this->octree_depth_;
@@ -200,7 +200,7 @@ public:
* setInputCloud)
*/
void
- addPointFromCloud(const int point_idx_arg, IndicesPtr indices_arg);
+ addPointFromCloud(uindex_t point_idx_arg, IndicesPtr indices_arg);
/** \brief Add point simultaneously to octree and input point cloud.
* \param[in] point_arg point to be added
@@ -258,14 +258,14 @@ public:
* \return "true" if voxel exist; "false" otherwise
*/
bool
- isVoxelOccupiedAtPoint(const int& point_idx_arg) const;
+ isVoxelOccupiedAtPoint(const index_t& point_idx_arg) const;
/** \brief Get a PointT vector of centers of all occupied voxels.
* \param[out] voxel_center_list_arg results are written to this vector of PointT
* elements
* \return number of occupied voxels
*/
- int
+ uindex_t
getOccupiedVoxelCenters(AlignedPointTVector& voxel_center_list_arg) const;
/** \brief Get a PointT vector of centers of voxels intersected by a line segment.
@@ -279,7 +279,7 @@ public:
* octree_resolution x precision
* \return number of intersected voxels
*/
- int
+ uindex_t
getApproxIntersectedVoxelCentersBySegment(const Eigen::Vector3f& origin,
const Eigen::Vector3f& end,
AlignedPointTVector& voxel_center_list,
@@ -295,7 +295,7 @@ public:
* \param[in] point_idx_arg index of point addressing the voxel to be deleted.
*/
void
- deleteVoxelAtPoint(const int& point_idx_arg);
+ deleteVoxelAtPoint(const index_t& point_idx_arg);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Bounding box methods
@@ -365,7 +365,7 @@ public:
* \return squared diameter
*/
double
- getVoxelSquaredDiameter(unsigned int tree_depth_arg) const;
+ getVoxelSquaredDiameter(uindex_t tree_depth_arg) const;
/** \brief Calculates the squared diameter of a voxel at leaf depth
* \return squared diameter
@@ -381,7 +381,7 @@ public:
* \return squared voxel cube side length
*/
double
- getVoxelSquaredSideLen(unsigned int tree_depth_arg) const;
+ getVoxelSquaredSideLen(uindex_t tree_depth_arg) const;
/** \brief Calculates the squared voxel cube side length at leaf level
* \return squared voxel cube side length
@@ -428,7 +428,7 @@ protected:
* \a setInputCloud to be added
*/
virtual void
- addPointIdx(const int point_idx_arg);
+ addPointIdx(uindex_t point_idx_arg);
/** \brief Add point at index from input pointcloud dataset to octree
* \param[in] leaf_node to be expanded
@@ -440,7 +440,7 @@ protected:
expandLeafNode(LeafNode* leaf_node,
BranchNode* parent_branch,
unsigned char child_idx,
- unsigned int depth_mask);
+ uindex_t depth_mask);
/** \brief Get point at index from input pointcloud dataset
* \param[in] index_arg index representing the point in the dataset given by \a
@@ -448,7 +448,7 @@ protected:
* \return PointT from input pointcloud dataset
*/
const PointT&
- getPointByIndex(const unsigned int index_arg) const;
+ getPointByIndex(uindex_t index_arg) const;
/** \brief Find octree leaf node at a given point
* \param[in] point_arg query point
@@ -520,7 +520,7 @@ protected:
* are assignable
*/
virtual bool
- genOctreeKeyForDataT(const int& data_arg, OctreeKey& key_arg) const;
+ genOctreeKeyForDataT(const index_t& data_arg, OctreeKey& key_arg) const;
/** \brief Generate a point at center of leaf node voxel
* \param[in] key_arg octree key addressing a leaf node.
@@ -536,7 +536,7 @@ protected:
*/
void
genVoxelCenterFromOctreeKey(const OctreeKey& key_arg,
- unsigned int tree_depth_arg,
+ uindex_t tree_depth_arg,
PointT& point_arg) const;
/** \brief Generate bounds of an octree voxel using octree key and tree depth
@@ -548,7 +548,7 @@ protected:
*/
void
genVoxelBoundsFromOctreeKey(const OctreeKey& key_arg,
- unsigned int tree_depth_arg,
+ uindex_t tree_depth_arg,
Eigen::Vector3f& min_pt,
Eigen::Vector3f& max_pt) const;
@@ -560,7 +560,7 @@ protected:
* elements
* \return number of voxels found
*/
- int
+ uindex_t
getOccupiedVoxelCentersRecursive(const BranchNode* node_arg,
const OctreeKey& key_arg,
AlignedPointTVector& voxel_center_list_arg) const;
diff --git a/octree/include/pcl/octree/octree_pointcloud_adjacency.h b/octree/include/pcl/octree/octree_pointcloud_adjacency.h
index 64db9804..0d4ea118 100644
--- a/octree/include/pcl/octree/octree_pointcloud_adjacency.h
+++ b/octree/include/pcl/octree/octree_pointcloud_adjacency.h
@@ -39,12 +39,10 @@
#pragma once
-#include <pcl/octree/boost.h>
#include <pcl/octree/octree_pointcloud.h>
#include <pcl/octree/octree_pointcloud_adjacency_container.h>
-#include <list>
-#include <set>
+#include <boost/graph/adjacency_list.hpp> // for adjacency_list
namespace pcl {
@@ -197,7 +195,7 @@ protected:
* \note This virtual implementation allows the use of a transform function to compute
* keys. */
void
- addPointIdx(const int point_idx_arg) override;
+ addPointIdx(uindex_t point_idx_arg) override;
/** \brief Fills in the neighbors fields for new voxels.
*
diff --git a/octree/include/pcl/octree/octree_pointcloud_adjacency_container.h b/octree/include/pcl/octree/octree_pointcloud_adjacency_container.h
index b6e5ad62..6cff9dad 100644
--- a/octree/include/pcl/octree/octree_pointcloud_adjacency_container.h
+++ b/octree/include/pcl/octree/octree_pointcloud_adjacency_container.h
@@ -39,6 +39,8 @@
#pragma once
+#include <list> // for std::list
+
namespace pcl {
namespace octree {
@@ -92,7 +94,7 @@ public:
}
/** \brief Gets the number of points contributing to this leaf */
- int
+ uindex_t
getPointCounter() const
{
return num_points_;
@@ -117,7 +119,7 @@ public:
/** \brief virtual method to get size of container
* \return number of points added to leaf node container.
*/
- std::size_t
+ uindex_t
getSize() const override
{
return num_points_;
@@ -168,7 +170,7 @@ protected:
/** \brief Sets the number of points contributing to this leaf */
void
- setPointCounter(int points_arg)
+ setPointCounter(uindex_t points_arg)
{
num_points_ = points_arg;
}
@@ -216,7 +218,7 @@ protected:
}
private:
- int num_points_;
+ uindex_t num_points_;
NeighborListT neighbors_;
DataT data_;
};
diff --git a/octree/include/pcl/octree/octree_pointcloud_changedetector.h b/octree/include/pcl/octree/octree_pointcloud_changedetector.h
index 902dfd2c..c8ddadf3 100644
--- a/octree/include/pcl/octree/octree_pointcloud_changedetector.h
+++ b/octree/include/pcl/octree/octree_pointcloud_changedetector.h
@@ -91,15 +91,15 @@ public:
* \return number of point indices
*/
std::size_t
- getPointIndicesFromNewVoxels(std::vector<int>& indicesVector_arg,
- const int minPointsPerLeaf_arg = 0)
+ getPointIndicesFromNewVoxels(Indices& indicesVector_arg,
+ const uindex_t minPointsPerLeaf_arg = 0)
{
std::vector<OctreeContainerPointIndices*> leaf_containers;
this->serializeNewLeafs(leaf_containers);
for (const auto& leaf_container : leaf_containers) {
- if (static_cast<int>(leaf_container->getSize()) >= minPointsPerLeaf_arg)
+ if (static_cast<uindex_t>(leaf_container->getSize()) >= minPointsPerLeaf_arg)
leaf_container->getPointIndices(indicesVector_arg);
}
diff --git a/octree/include/pcl/octree/octree_pointcloud_density.h b/octree/include/pcl/octree/octree_pointcloud_density.h
index 19e97d04..72be1cb1 100644
--- a/octree/include/pcl/octree/octree_pointcloud_density.h
+++ b/octree/include/pcl/octree/octree_pointcloud_density.h
@@ -76,16 +76,12 @@ public:
/** \brief Read input data. Only an internal counter is increased.
*/
- void
- addPointIndex(int)
- {
- point_counter_++;
- }
+ void addPointIndex(uindex_t) { point_counter_++; }
/** \brief Return point counter.
* \return Amount of points
*/
- unsigned int
+ uindex_t
getPointCounter()
{
return (point_counter_);
@@ -99,7 +95,7 @@ public:
}
private:
- unsigned int point_counter_;
+ uindex_t point_counter_;
};
/** \brief @b Octree pointcloud density class
@@ -133,10 +129,10 @@ public:
* \param[in] point_arg: a point addressing a voxel \return amount of points
* that fall within leaf node voxel
*/
- unsigned int
+ uindex_t
getVoxelDensityAtPoint(const PointT& point_arg) const
{
- unsigned int point_count = 0;
+ uindex_t point_count = 0;
OctreePointCloudDensityContainer* leaf = this->findLeafAtPoint(point_arg);
@@ -149,5 +145,8 @@ public:
} // namespace octree
} // namespace pcl
+// needed since OctreePointCloud is not instantiated with template parameters used above
+#include <pcl/octree/impl/octree_pointcloud.hpp>
+
#define PCL_INSTANTIATE_OctreePointCloudDensity(T) \
template class PCL_EXPORTS pcl::octree::OctreePointCloudDensity<T>;
diff --git a/octree/include/pcl/octree/octree_pointcloud_singlepoint.h b/octree/include/pcl/octree/octree_pointcloud_singlepoint.h
index a307bc89..3c8e71e5 100644
--- a/octree/include/pcl/octree/octree_pointcloud_singlepoint.h
+++ b/octree/include/pcl/octree/octree_pointcloud_singlepoint.h
@@ -86,5 +86,8 @@ public:
} // namespace octree
} // namespace pcl
+// needed since OctreePointCloud is not instantiated with template parameters used above
+#include <pcl/octree/impl/octree_pointcloud.hpp>
+
#define PCL_INSTANTIATE_OctreePointCloudSinglePoint(T) \
template class PCL_EXPORTS pcl::octree::OctreePointCloudSinglePoint<T>;
diff --git a/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h b/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h
index 1207db8e..a3111336 100644
--- a/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h
+++ b/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h
@@ -114,7 +114,7 @@ public:
}
private:
- unsigned int point_counter_;
+ uindex_t point_counter_;
PointT point_sum_;
};
@@ -156,11 +156,11 @@ public:
* \param pointIdx_arg
*/
void
- addPointIdx(const int pointIdx_arg) override
+ addPointIdx(const uindex_t pointIdx_arg) override
{
OctreeKey key;
- assert(pointIdx_arg < static_cast<int>(this->input_->size()));
+ assert(pointIdx_arg < this->input_->size());
const PointT& point = (*this->input_)[pointIdx_arg];
@@ -190,7 +190,8 @@ public:
* \return "true" if voxel is found; "false" otherwise
*/
inline bool
- getVoxelCentroidAtPoint(const int& point_idx_arg, PointT& voxel_centroid_arg) const
+ getVoxelCentroidAtPoint(const index_t& point_idx_arg,
+ PointT& voxel_centroid_arg) const
{
// get centroid at point
return (this->getVoxelCentroidAtPoint((*this->input_)[point_idx_arg],
@@ -202,7 +203,7 @@ public:
* elements
* \return number of occupied voxels
*/
- std::size_t
+ uindex_t
getVoxelCentroids(
typename OctreePointCloud<PointT, LeafContainerT, BranchContainerT>::
AlignedPointTVector& voxel_centroid_list_arg) const;
diff --git a/octree/include/pcl/octree/octree_search.h b/octree/include/pcl/octree/octree_search.h
index 83d30c6f..ed29fb2d 100644
--- a/octree/include/pcl/octree/octree_search.h
+++ b/octree/include/pcl/octree/octree_search.h
@@ -58,8 +58,8 @@ class OctreePointCloudSearch
: public OctreePointCloud<PointT, LeafContainerT, BranchContainerT> {
public:
// public typedefs
- using IndicesPtr = shared_ptr<std::vector<int>>;
- using IndicesConstPtr = shared_ptr<const std::vector<int>>;
+ using IndicesPtr = shared_ptr<Indices>;
+ using IndicesConstPtr = shared_ptr<const Indices>;
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = typename PointCloud::Ptr;
@@ -91,7 +91,7 @@ public:
* \return "true" if leaf node exist; "false" otherwise
*/
bool
- voxelSearch(const PointT& point, std::vector<int>& point_idx_data);
+ voxelSearch(const PointT& point, Indices& point_idx_data);
/** \brief Search for neighbors within a voxel at given point referenced by a point
* index
@@ -100,7 +100,7 @@ public:
* \return "true" if leaf node exist; "false" otherwise
*/
bool
- voxelSearch(const int index, std::vector<int>& point_idx_data);
+ voxelSearch(uindex_t index, Indices& point_idx_data);
/** \brief Search for k-nearest neighbors at the query point.
* \param[in] cloud the point cloud data
@@ -112,11 +112,11 @@ public:
* points (must be resized to \a k a priori!)
* \return number of neighbors found
*/
- inline int
+ inline uindex_t
nearestKSearch(const PointCloud& cloud,
- int index,
- int k,
- std::vector<int>& k_indices,
+ uindex_t index,
+ uindex_t k,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances)
{
return (nearestKSearch(cloud[index], k, k_indices, k_sqr_distances));
@@ -131,10 +131,10 @@ public:
* points (must be resized to k a priori!)
* \return number of neighbors found
*/
- int
+ uindex_t
nearestKSearch(const PointT& p_q,
- int k,
- std::vector<int>& k_indices,
+ uindex_t k,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances);
/** \brief Search for k-nearest neighbors at query point
@@ -148,10 +148,10 @@ public:
* points (must be resized to \a k a priori!)
* \return number of neighbors found
*/
- int
- nearestKSearch(int index,
- int k,
- std::vector<int>& k_indices,
+ uindex_t
+ nearestKSearch(uindex_t index,
+ uindex_t k,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances);
/** \brief Search for approx. nearest neighbor at the query point.
@@ -163,8 +163,8 @@ public:
*/
inline void
approxNearestSearch(const PointCloud& cloud,
- int query_index,
- int& result_index,
+ uindex_t query_index,
+ index_t& result_index,
float& sqr_distance)
{
return (approxNearestSearch(cloud[query_index], result_index, sqr_distance));
@@ -176,7 +176,7 @@ public:
* \param[out] sqr_distance the resultant squared distance to the neighboring point
*/
void
- approxNearestSearch(const PointT& p_q, int& result_index, float& sqr_distance);
+ approxNearestSearch(const PointT& p_q, index_t& result_index, float& sqr_distance);
/** \brief Search for approx. nearest neighbor at the query point.
* \param[in] query_index index representing the query point in the dataset given by
@@ -187,7 +187,7 @@ public:
* \return number of neighbors found
*/
void
- approxNearestSearch(int query_index, int& result_index, float& sqr_distance);
+ approxNearestSearch(uindex_t query_index, index_t& result_index, float& sqr_distance);
/** \brief Search for all neighbors of query point that are within a given radius.
* \param[in] cloud the point cloud data
@@ -199,13 +199,13 @@ public:
* \param[in] max_nn if given, bounds the maximum returned neighbors to this value
* \return number of neighbors found in radius
*/
- int
+ uindex_t
radiusSearch(const PointCloud& cloud,
- int index,
+ uindex_t index,
double radius,
- std::vector<int>& k_indices,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn = 0)
+ index_t max_nn = 0)
{
return (radiusSearch(cloud[index], radius, k_indices, k_sqr_distances, max_nn));
}
@@ -219,12 +219,12 @@ public:
* \param[in] max_nn if given, bounds the maximum returned neighbors to this value
* \return number of neighbors found in radius
*/
- int
+ uindex_t
radiusSearch(const PointT& p_q,
const double radius,
- std::vector<int>& k_indices,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn = 0) const;
+ uindex_t max_nn = 0) const;
/** \brief Search for all neighbors of query point that are within a given radius.
* \param[in] index index representing the query point in the dataset given by \a
@@ -237,12 +237,12 @@ public:
* \param[in] max_nn if given, bounds the maximum returned neighbors to this value
* \return number of neighbors found in radius
*/
- int
- radiusSearch(int index,
+ uindex_t
+ radiusSearch(uindex_t index,
const double radius,
- std::vector<int>& k_indices,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn = 0) const;
+ uindex_t max_nn = 0) const;
/** \brief Get a PointT vector of centers of all voxels that intersected by a ray
* (origin, direction).
@@ -253,11 +253,11 @@ public:
* disable)
* \return number of intersected voxels
*/
- int
+ uindex_t
getIntersectedVoxelCenters(Eigen::Vector3f origin,
Eigen::Vector3f direction,
AlignedPointTVector& voxel_center_list,
- int max_voxel_count = 0) const;
+ uindex_t max_voxel_count = 0) const;
/** \brief Get indices of all voxels that are intersected by a ray (origin,
* direction).
@@ -267,11 +267,11 @@ public:
* disable)
* \return number of intersected voxels
*/
- int
+ uindex_t
getIntersectedVoxelIndices(Eigen::Vector3f origin,
Eigen::Vector3f direction,
- std::vector<int>& k_indices,
- int max_voxel_count = 0) const;
+ Indices& k_indices,
+ uindex_t max_voxel_count = 0) const;
/** \brief Search for points within rectangular search area
* Points exactly on the edges of the search rectangle are included.
@@ -280,10 +280,10 @@ public:
* \param[out] k_indices the resultant point indices
* \return number of points found within search area
*/
- int
+ uindex_t
boxSearch(const Eigen::Vector3f& min_pt,
const Eigen::Vector3f& max_pt,
- std::vector<int>& k_indices) const;
+ Indices& k_indices) const;
protected:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -341,7 +341,7 @@ protected:
* \param[in] point_idx index for a dataset point given by \a setInputCloud
* \param[in] point_distance distance of query point to voxel center
*/
- prioPointQueueEntry(unsigned int& point_idx, float point_distance)
+ prioPointQueueEntry(uindex_t point_idx, float point_distance)
: point_idx_(point_idx), point_distance_(point_distance)
{}
@@ -355,7 +355,7 @@ protected:
}
/** \brief Index representing a point in the dataset given by \a setInputCloud. */
- int point_idx_;
+ uindex_t point_idx_;
/** \brief Distance to query point. */
float point_distance_;
@@ -388,10 +388,10 @@ protected:
const double radiusSquared,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
- std::vector<int>& k_indices,
+ uindex_t tree_depth,
+ Indices& k_indices,
std::vector<float>& k_sqr_distances,
- unsigned int max_nn) const;
+ uindex_t max_nn) const;
/** \brief Recursive search method that explores the octree and finds the K nearest
* neighbors
@@ -407,10 +407,10 @@ protected:
double
getKNearestNeighborRecursive(
const PointT& point,
- unsigned int K,
+ uindex_t K,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
+ uindex_t tree_depth,
const double squared_search_radius,
std::vector<prioPointQueueEntry>& point_candidates) const;
@@ -427,8 +427,8 @@ protected:
approxNearestSearchRecursive(const PointT& point,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
- int& result_index,
+ uindex_t tree_depth,
+ index_t& result_index,
float& sqr_distance);
/** \brief Recursively search the tree for all intersected leaf nodes and return a
@@ -449,7 +449,7 @@ protected:
* disable)
* \return number of voxels found
*/
- int
+ uindex_t
getIntersectedVoxelCentersRecursive(double min_x,
double min_y,
double min_z,
@@ -460,7 +460,7 @@ protected:
const OctreeNode* node,
const OctreeKey& key,
AlignedPointTVector& voxel_center_list,
- int max_voxel_count) const;
+ uindex_t max_voxel_count) const;
/** \brief Recursive search method that explores the octree and finds points within a
* rectangular search area
@@ -476,8 +476,8 @@ protected:
const Eigen::Vector3f& max_pt,
const BranchNode* node,
const OctreeKey& key,
- unsigned int tree_depth,
- std::vector<int>& k_indices) const;
+ uindex_t tree_depth,
+ Indices& k_indices) const;
/** \brief Recursively search the tree for all intersected leaf nodes and return a
* vector of indices. This algorithm is based off the paper An Efficient Parametric
@@ -496,7 +496,7 @@ protected:
* disable)
* \return number of voxels found
*/
- int
+ uindex_t
getIntersectedVoxelIndicesRecursive(double min_x,
double min_y,
double min_z,
@@ -506,8 +506,8 @@ protected:
unsigned char a,
const OctreeNode* node,
const OctreeKey& key,
- std::vector<int>& k_indices,
- int max_voxel_count) const;
+ Indices& k_indices,
+ uindex_t max_voxel_count) const;
/** \brief Initialize raytracing algorithm
* \param origin
diff --git a/octree/src/octree_inst.cpp b/octree/src/octree_inst.cpp
index e0d26650..2f149f0b 100644
--- a/octree/src/octree_inst.cpp
+++ b/octree/src/octree_inst.cpp
@@ -39,8 +39,8 @@
// Instantiations of specific point types
-template class PCL_EXPORTS pcl::octree::OctreeBase<int>;
-template class PCL_EXPORTS pcl::octree::Octree2BufBase<int>;
+template class PCL_EXPORTS pcl::octree::OctreeBase<pcl::index_t>;
+template class PCL_EXPORTS pcl::octree::Octree2BufBase<pcl::index_t>;
template class PCL_EXPORTS
pcl::octree::OctreeBase<pcl::octree::OctreeContainerPointIndices,