Skip to content

Commit

Permalink
replace std::isfinate with pcl::isXYZFinite
Browse files Browse the repository at this point in the history
  • Loading branch information
QiuYilin committed Jun 17, 2024
1 parent 9a4b24f commit 0a8568a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions filters/include/pcl/filters/impl/uniform_sampling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include <pcl/common/common.h>
#include <pcl/filters/uniform_sampling.h>
#include <pcl/common/point_tests.h>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT> void
Expand Down Expand Up @@ -79,9 +80,7 @@ pcl::UniformSampling<PointT>::applyFilter (Indices &indices)
if (!input_->is_dense)
{
// Check if the point is invalid
if (!std::isfinite ((*input_)[cp].x) ||
!std::isfinite ((*input_)[cp].y) ||
!std::isfinite ((*input_)[cp].z))
if (!pcl::isXYZFinite ((*input_)[cp]))
{
if (extract_removed_indices_)
(*removed_indices_)[rii++] = cp;
Expand Down
9 changes: 4 additions & 5 deletions test/filters/test_uniform_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ TEST(UniformSampling, extractRemovedIndices)
pcl::PointCloud<pcl::PointXYZ> output;
pcl::Indices indices;

//empty input cloud
// Empty input cloud
us_ptr->filter(output);
us_ptr->filter(indices);

us_ptr->setInputCloud(xyz);
//cloud
// Cloud
us_ptr->filter(output);

//indices
// Indices
us_ptr->filter(indices);

for (const auto& outputIndex : indices)
Expand Down Expand Up @@ -109,7 +108,7 @@ TEST(UniformSampling, extractRemovedIndices)
EXPECT_EQ (int (removed_indices->size ()), 1000);
EXPECT_EQ (int (output.size ()), int (xyz->size() - 1000));

//Organized
// Organized
us_ptr->setKeepOrganized (true);
us_ptr->setNegative (false);
us_ptr->filter(output);
Expand Down

0 comments on commit 0a8568a

Please sign in to comment.