diff --git a/.ci/azure-pipelines/build-ubuntu.yml b/.ci/azure-pipelines/build-ubuntu.yml index 7c24a2fe69e..2fc90c2d184 100644 --- a/.ci/azure-pipelines/build-ubuntu.yml +++ b/.ci/azure-pipelines/build-ubuntu.yml @@ -13,11 +13,21 @@ jobs: variables: BUILD_DIR: '$(Agent.BuildDirectory)/build' CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2' + CCACHE_DIR: $(Pipeline.Workspace)/ccache + CCACHE_MAXSIZE: 15G steps: + - task: CacheBeta@0 + inputs: + key: ccache | gcc | $(Agent.OS) + path: $(CCACHE_DIR) + displayName: ccache + - script: ccache -z + displayName: 'Zero ccache statistics' - script: | mkdir $BUILD_DIR && cd $BUILD_DIR cmake $(Build.SourcesDirectory) \ -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ + -DPCL_DISABLE_CCACHE=OFF \ -DPCL_ONLY_CORE_POINT_TYPES=ON \ -DBUILD_simulation=ON \ -DBUILD_surface_on_nurbs=ON \ @@ -41,6 +51,8 @@ jobs: cmake --build . -- test_filters test_registration test_registration_api cmake --build . -- -j2 displayName: 'Build Library' + - script: ccache -s + displayName: 'Display ccache statistics' - script: | cd $BUILD_DIR/test ctest -V -T Test diff --git a/features/include/pcl/features/impl/rops_estimation.hpp b/features/include/pcl/features/impl/rops_estimation.hpp index d4e4656cd7f..182e75cf11b 100644 --- a/features/include/pcl/features/impl/rops_estimation.hpp +++ b/features/include/pcl/features/impl/rops_estimation.hpp @@ -144,7 +144,7 @@ pcl::ROPSEstimation ::computeFeature (PointCloudOut &output //feature size = number_of_rotations * number_of_axis_to_rotate_around * number_of_projections * number_of_central_moments unsigned int feature_size = number_of_rotations_ * 3 * 3 * 5; - unsigned int number_of_points = static_cast (indices_->size ()); + const auto number_of_points = indices_->size (); output.points.resize (number_of_points, PointOutT ()); for (unsigned int i_point = 0; i_point < number_of_points; i_point++) @@ -382,10 +382,10 @@ pcl::ROPSEstimation ::computeEigenVectors (const Eigen::Mat template void pcl::ROPSEstimation ::transformCloud (const PointInT& point, const Eigen::Matrix3f& matrix, const std::vector & local_points, PointCloudIn& transformed_cloud) const { - const unsigned int number_of_points = static_cast (local_points.size ()); + const auto number_of_points = local_points.size (); transformed_cloud.points.resize (number_of_points, PointInT ()); - for (unsigned int i = 0; i < number_of_points; i++) + for (std::size_t i = 0; i < number_of_points; i++) { Eigen::Vector3f transformed_point ( surface_->points[local_points[i]].x - point.x, @@ -417,7 +417,7 @@ pcl::ROPSEstimation ::rotateCloud (const PointInT& axis, co (1 - cosine) * y * x + sine * z, cosine + (1 - cosine) * y * y, (1 - cosine) * y * z - sine * x, (1 - cosine) * z * x - sine * y, (1 - cosine) * z * y + sine * x, cosine + (1 - cosine) * z * z; - const unsigned int number_of_points = static_cast (cloud.points.size ()); + const auto number_of_points = cloud.points.size (); rotated_cloud.header = cloud.header; rotated_cloud.width = number_of_points; @@ -431,7 +431,7 @@ pcl::ROPSEstimation ::rotateCloud (const PointInT& axis, co max (1) = -std::numeric_limits ::max (); max (2) = -std::numeric_limits ::max (); - for (unsigned int i_point = 0; i_point < number_of_points; i_point++) + for (std::size_t i_point = 0; i_point < number_of_points; i_point++) { Eigen::Vector3f point ( cloud.points[i_point].x, @@ -445,13 +445,11 @@ pcl::ROPSEstimation ::rotateCloud (const PointInT& axis, co rotated_point.z = point (2); rotated_cloud.points[i_point] = rotated_point; - if (min (0) > rotated_point.x) min (0) = rotated_point.x; - if (min (1) > rotated_point.y) min (1) = rotated_point.y; - if (min (2) > rotated_point.z) min (2) = rotated_point.z; - - if (max (0) < rotated_point.x) max (0) = rotated_point.x; - if (max (1) < rotated_point.y) max (1) = rotated_point.y; - if (max (2) < rotated_point.z) max (2) = rotated_point.z; + for (int i = 0; i < 3; ++i) + { + min(i) = std::min(min(i), point(i)); + max(i) = std::max(max(i), point(i)); + } } } @@ -461,8 +459,6 @@ pcl::ROPSEstimation ::getDistributionMatrix (const unsigned { matrix.setZero (); - const unsigned int number_of_points = static_cast (cloud.points.size ()); - const unsigned int coord[3][2] = { {0, 1}, {0, 2}, @@ -471,12 +467,9 @@ pcl::ROPSEstimation ::getDistributionMatrix (const unsigned const float u_bin_length = (max (coord[projection][0]) - min (coord[projection][0])) / number_of_bins_; const float v_bin_length = (max (coord[projection][1]) - min (coord[projection][1])) / number_of_bins_; - for (unsigned int i_point = 0; i_point < number_of_points; i_point++) + for (const auto& pt: cloud.points) { - Eigen::Vector3f point ( - cloud.points[i_point].x, - cloud.points[i_point].y, - cloud.points[i_point].z); + Eigen::Vector3f point (pt.x, pt.y, pt.z); const float u_length = point (coord[projection][0]) - min[coord[projection][0]]; const float v_length = point (coord[projection][1]) - min[coord[projection][1]]; @@ -492,7 +485,7 @@ pcl::ROPSEstimation ::getDistributionMatrix (const unsigned matrix (row, col) += 1.0f; } - matrix /= static_cast (number_of_points); + matrix /= static_cast (std::min(1, cloud.points.size ())); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////