You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Help wanted: Extend BruteForce search to point types without xyz #6421
For point types/feature types that do not have xyz information, PCL currently relies on the external search libraries FLANN and nanoflann. However, it would be nice to have some fallback search method that is available even if neither FLANN nor nanoflann is installed. The fallback method does not have to be fast, it is just to have some option without relying on external libraries. The BruteForce class could be an option for that, however it currently only supports types with xyz information (see e.g. the getDistSqr function: https://github.com/PointCloudLibrary/pcl/blob/master/search/include/pcl/search/impl/brute_force.hpp#L46 ). For non-xyz types, it would probably have to make use of the PointRepresentation class, to convert a point/feature to a vector/array for computing the distance. Ideally, BruteForce should decide at compile-time (maybe with if constexpr?) whether it can use getVector3fMap like before or has to use PointRepresentation::vectorize.
So tasks are:
investigate what would have to be changed in BruteForce to support non-xyz point/features types, post the findings here (no extensive code, just the ideas, so that we can decide if that is a good way to move forward)
extend the tests in test/search to make sure that the adapted BruteForce class gives the same results as either KdTree or KdTreeNanoflann on 1-2 feature types (for inspiration, test_kdtree_nanoflann.cpp might be a starting point)
I've looked into this and found that we can generalize BruteForce quite cleanly by following the KdTree pattern.
My proposed modifications:
Add a PointRepresentation member with the necessary getter/setter.
Override setInputCloud to initialize a DefaultPointRepresentation for non-XYZ types automatically, to make the class work for descriptors without extra configuration.
Refactor getDistSqr using if constexpr (has_xyz_v), to keep the fast getVector3fMap() logic for standard points while providing a fallback for features.
Swap out the hardcoded .x finiteness checks in the search loops for pcl::isFinite(), making the search work for any descriptor type.
I've benchmarked this on FPFH features (33 dim), and a simple loop is fast enough (~2.5ms for 10k points). Also tested it to confirm it gives the same results as KdTree.
Tell me what you think, @mvieth?
@AlrIsmail Thank you for posting your ideas, they sound very reasonable. However, I think it would be fair to give @srishd a few more days (let's say until April 22nd) to make the next step, since they were the first to show interest in this issue. If @srishd has not made any progress until then, you @AlrIsmail are welcome to submit a pull request.
I’ve looked into the design and am working on the implementation (xyz / non-xyz compile-time split in getDistSqr, with PointRepresentation fallback and KdTree consistency tests). I’m aligning it with the existing KdTree pattern, where representation is explicitly configurable via a getter/setter and not inferred during setInputCloud().
I plan to share a draft pull request here for review in the next week.
Activity
srishd commentedon Apr 11, 2026
Hi @mvieth, I’d love to help with this if it’s still up for grabs. Can investigate and post findings here soon.
mvieth commentedon Apr 11, 2026
@srishd Hello, yes, this is still available. Feel free to go ahead.
AlrIsmail commentedon Apr 18, 2026
I've looked into this and found that we can generalize BruteForce quite cleanly by following the KdTree pattern.
My proposed modifications:
I've benchmarked this on FPFH features (33 dim), and a simple loop is fast enough (~2.5ms for 10k points). Also tested it to confirm it gives the same results as KdTree.
Tell me what you think, @mvieth?
mvieth commentedon Apr 18, 2026
@AlrIsmail Thank you for posting your ideas, they sound very reasonable. However, I think it would be fair to give @srishd a few more days (let's say until April 22nd) to make the next step, since they were the first to show interest in this issue. If @srishd has not made any progress until then, you @AlrIsmail are welcome to submit a pull request.
srishd commentedon Apr 21, 2026
Thanks @mvieth and @AlrIsmail.
I’ve looked into the design and am working on the implementation (xyz / non-xyz compile-time split in
getDistSqr, withPointRepresentationfallback and KdTree consistency tests). I’m aligning it with the existing KdTree pattern, where representation is explicitly configurable via a getter/setter and not inferred duringsetInputCloud().I plan to share a draft pull request here for review in the next week.
mvieth commentedon Jul 30, 2026
Since there has been no pull request so far, I would consider this issue to be "open for everyone" again.