Skip to content

Help wanted: Extend BruteForce search to point types without xyz #6421

Closed

Description

@mvieth

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)
  • create a pull request

If you have any questions, feel free to ask.

Activity

  1. srishd commented on Apr 11, 2026

    @srishd

    Hi @mvieth, I’d love to help with this if it’s still up for grabs. Can investigate and post findings here soon.

  2. mvieth commented on Apr 11, 2026

    @mvieth
    MemberAuthor

    @srishd Hello, yes, this is still available. Feel free to go ahead.

  3. AlrIsmail commented on Apr 18, 2026

    @AlrIsmail
    Contributor

    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?
  4. mvieth commented on Apr 18, 2026

    @mvieth
    MemberAuthor

    @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.

  5. srishd commented on Apr 21, 2026

    @srishd

    Thanks @mvieth and @AlrIsmail.

    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.

  6. mvieth commented on Jul 30, 2026

    @mvieth
    MemberAuthor

    Since there has been no pull request so far, I would consider this issue to be "open for everyone" again.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions