Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sign-compare warnings issued by AppleClang #3777

Merged
merged 5 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions features/include/pcl/features/impl/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pcl::BOARDLocalReferenceFrameEstimation<PointInT, PointNT, PointOutT>::computePo
//extract support points for Rz radius
std::vector<int> neighbours_indices;
std::vector<float> neighbours_distances;
int n_neighbours = this->searchForNeighbors (index, search_parameter_, neighbours_indices, neighbours_distances);
std::size_t n_neighbours = this->searchForNeighbors (index, search_parameter_, neighbours_indices, neighbours_distances);

//check if there are enough neighbor points, otherwise compute a random X axis and use normal as Z axis
if (n_neighbours < 6)
Expand All @@ -206,7 +206,7 @@ pcl::BOARDLocalReferenceFrameEstimation<PointInT, PointNT, PointOutT>::computePo

//copy neighbours coordinates into eigen matrix
Eigen::Matrix<float, Eigen::Dynamic, 3> neigh_points_mat (n_neighbours, 3);
for (int i = 0; i < n_neighbours; ++i)
for (std::size_t i = 0; i < n_neighbours; ++i)
{
neigh_points_mat.row (i) = (*surface_)[neighbours_indices[i]].getVector3fMap ();
}
Expand Down Expand Up @@ -311,7 +311,7 @@ pcl::BOARDLocalReferenceFrameEstimation<PointInT, PointNT, PointOutT>::computePo
if (!margin_point_found)
{
//find among points with neighDistance <= marginThresh*radius
for (int curr_neigh = 0; curr_neigh < n_neighbours; curr_neigh++)
for (std::size_t curr_neigh = 0; curr_neigh < n_neighbours; curr_neigh++)
{
const int& curr_neigh_idx = neighbours_indices[curr_neigh];
const float& neigh_distance_sqr = neighbours_distances[curr_neigh];
Expand Down Expand Up @@ -448,7 +448,7 @@ pcl::BOARDLocalReferenceFrameEstimation<PointInT, PointNT, PointOutT>::computePo
float max_hole_prob = -std::numeric_limits<float>::max ();

//find holes
for (auto ch = first_no_border; ch < check_margin_array_size_; ch++)
for (auto ch = first_no_border; ch < static_cast<std::size_t>(check_margin_array_size_); ch++)
{
if (!check_margin_array_[ch])
{
Expand Down
3 changes: 2 additions & 1 deletion features/include/pcl/features/impl/cppf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ pcl::CPPFEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut
{
PointOutT p;
// No need to calculate feature for identity pair (i, j) as they aren't used in future calculations
if (i != j)
// @TODO: resolve issue with comparison in a better manner
if (static_cast<std::size_t>(i) != j)
{
if (
pcl::computeCPPFPairFeature (input_->points[i].getVector4fMap (),
Expand Down
6 changes: 3 additions & 3 deletions features/include/pcl/features/impl/flare.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ template<typename PointInT, typename PointNT, typename PointOutT, typename Signe
}

if (sampled_tree_->getInputCloud () != sampled_surface_) // Make sure the tree searches the sampled surface
sampled_tree_->setInputCloud (sampled_surface_);
sampled_tree_->setInputCloud (sampled_surface_);

return (true);
}
Expand Down Expand Up @@ -121,7 +121,7 @@ template<typename PointInT, typename PointNT, typename PointOutT, typename Signe

const std::size_t n_normal_neighbours =
this->searchForNeighbors (index, search_parameter_, neighbours_indices, neighbours_distances);
if (n_normal_neighbours < min_neighbors_for_normal_axis_)
if (n_normal_neighbours < static_cast<std::size_t>(min_neighbors_for_normal_axis_))
{
if (!pcl::isFinite ((*normals_)[index]))
{
Expand Down Expand Up @@ -158,7 +158,7 @@ template<typename PointInT, typename PointNT, typename PointOutT, typename Signe
const std::size_t n_tangent_neighbours =
sampled_tree_->radiusSearch ((*input_)[index], tangent_radius_, neighbours_indices, neighbours_distances);

if (n_tangent_neighbours < min_neighbors_for_tangent_axis_)
if (n_tangent_neighbours < static_cast<std::size_t>(min_neighbors_for_tangent_axis_))
{
//set X axis as a random axis
x_axis = pcl::geometry::randomOrthogonalAxis (fitted_normal);
Expand Down
14 changes: 7 additions & 7 deletions features/include/pcl/features/impl/fpfh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pcl::FPFHEstimation<PointInT, PointNT, PointOutT>::computePairFeatures (
}

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointNT, typename PointOutT> void
template <typename PointInT, typename PointNT, typename PointOutT> void
pcl::FPFHEstimation<PointInT, PointNT, PointOutT>::computePointSPFHSignature (
const pcl::PointCloud<PointInT> &cloud, const pcl::PointCloud<PointNT> &normals,
int p_idx, int row, const std::vector<int> &indices,
Expand Down Expand Up @@ -133,21 +133,21 @@ pcl::FPFHEstimation<PointInT, PointNT, PointOutT>::weightPointSPFHSignature (
weight = 1.0f / dists[idx];

// Weight the SPFH of the query point with the SPFH of its neighbors
for (std::size_t f1_i = 0; f1_i < nr_bins_f1; ++f1_i)
for (Eigen::MatrixXf::Index f1_i = 0; f1_i < nr_bins_f1; ++f1_i)
{
val_f1 = hist_f1 (indices[idx], f1_i) * weight;
sum_f1 += val_f1;
fpfh_histogram[f1_i] += val_f1;
}

for (std::size_t f2_i = 0; f2_i < nr_bins_f2; ++f2_i)
for (Eigen::MatrixXf::Index f2_i = 0; f2_i < nr_bins_f2; ++f2_i)
{
val_f2 = hist_f2 (indices[idx], f2_i) * weight;
sum_f2 += val_f2;
fpfh_histogram[f2_i + nr_bins_f1] += val_f2;
}

for (std::size_t f3_i = 0; f3_i < nr_bins_f3; ++f3_i)
for (Eigen::MatrixXf::Index f3_i = 0; f3_i < nr_bins_f3; ++f3_i)
{
val_f3 = hist_f3 (indices[idx], f3_i) * weight;
sum_f3 += val_f3;
Expand Down Expand Up @@ -258,7 +258,7 @@ pcl::FPFHEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut
continue;
}

// ... and remap the nn_indices values so that they represent row indices in the spfh_hist_* matrices
// ... and remap the nn_indices values so that they represent row indices in the spfh_hist_* matrices
// instead of indices into surface_->points
for (auto &nn_index : nn_indices)
nn_index = spfh_hist_lookup[nn_index];
Expand All @@ -285,7 +285,7 @@ pcl::FPFHEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut
continue;
}

// ... and remap the nn_indices values so that they represent row indices in the spfh_hist_* matrices
// ... and remap the nn_indices values so that they represent row indices in the spfh_hist_* matrices
// instead of indices into surface_->points
for (auto &nn_index : nn_indices)
nn_index = spfh_hist_lookup[nn_index];
Expand All @@ -301,5 +301,5 @@ pcl::FPFHEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut

#define PCL_INSTANTIATE_FPFHEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::FPFHEstimation<T,NT,OutT>;

#endif // PCL_FEATURES_IMPL_FPFH_H_
#endif // PCL_FEATURES_IMPL_FPFH_H_

Loading