Skip to content

filters: address TODOs for getMinMax3D to be templated and optimized#6409

Open
Stado1 wants to merge 2 commits intoPointCloudLibrary:masterfrom
Stado1:refactor-getminmax-pointcloud2
Open

filters: address TODOs for getMinMax3D to be templated and optimized#6409
Stado1 wants to merge 2 commits intoPointCloudLibrary:masterfrom
Stado1:refactor-getminmax-pointcloud2

Conversation

@Stado1
Copy link
Contributor

@Stado1 Stado1 commented Feb 23, 2026

This PR addresses the TODOs for getMinMax3D functions for PCLPointCloud2 to improve performance and allow for different types than just float to be used.

  • implemented templates:

    • Moved functions from voxel_grid.cpp to voxel_grid.hpp and templated them on T (for XYZ) and D (for distance fields). This fixes the TODO for only using float types.
  • Performance Optimization:

    • Added is_dense checks to skip std::isfinite calls when the cloud is guaranteed to be dense.
    • Moved a couple of operations outside of the for loop to avoid repeated operations.
    • Replaced Eigen::Array4f with separate variables of type T ( x, y, z).

@larshg larshg requested a review from Copilot February 24, 2026 14:09
@larshg larshg added module: filters changelog: enhancement Meta-information for changelog generation labels Feb 24, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the pcl::getMinMax3D overloads for pcl::PCLPointCloud2 to address TODOs by templating coordinate/distance types and applying a few micro-optimizations (e.g., skipping finiteness checks for dense clouds).

Changes:

  • Removed the non-templated PCLPointCloud2 getMinMax3D implementations from filters/src/voxel_grid.cpp.
  • Replaced the exported non-template declarations in voxel_grid.h with templated declarations for PCLPointCloud2.
  • Added the new templated PCLPointCloud2 getMinMax3D definitions into filters/include/pcl/filters/impl/voxel_grid.hpp, plus minor formatting cleanups.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
filters/src/voxel_grid.cpp Deletes the previous float-only PCLPointCloud2 min/max implementations (now moved to templates).
filters/include/pcl/filters/voxel_grid.h Replaces exported non-template API with template declarations for PCLPointCloud2 overloads.
filters/include/pcl/filters/impl/voxel_grid.hpp Adds templated PCLPointCloud2 min/max implementations and dense-branch optimizations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: enhancement Meta-information for changelog generation module: filters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants