nanoflann: A Header-Only KD-Tree Library for Exact Nearest-Neighbor Search on Compile-Time Product Manifolds
cs.RO, cs.DS
Submitted: 2026-10-10
Updated: 2026-10-10
Comments: 8 pages, 4 figures, accepted for publication in the IEEE Robotics and Automation Letters (IEEE RA-L)
Code: https://github.com/jlblancoc/nanoflann
License: http://creativecommons.org/licenses/by-nc-sa/4.0/
The gist: Nearest-neighbor (NN) search underlies countless robotics algorithms, but many state spaces are not Euclidean: orientations live on SO(2) or SO(3) and poses on SE(2) or SE(3), and a Euclidean KD-tree
Abstract
Nearest-neighbor (NN) search underlies countless robotics algorithms, but many state spaces are not Euclidean: orientations live on SO(2) or SO(3) and poses on SE(2) or SE(3), and a Euclidean KD-tree on their raw coordinates returns wrong neighbors. We present a header-only, dependency-free C++ KD-tree library for exact NN search on user-defined product manifolds declared at compile time: the space is composed from base manifolds (R n, SO(2), SO(3), S n; products SE(2), SE(3), tori) with a single type alias, and the library synthesizes a metric whose pruning is provably admissible, wrap-aware for circular coordinates and double-cover-aware for unit quaternions. Experiments confirm exactness (recall 1.0 vs an exhaustive scan under the same product metric), where the Euclidean-on-raw shortcut collapses to recall about 0.5 m for m rotation blocks, with up to three orders of magnitude speedup over brute force. We further contribute an incremental, self-balancing single-tree index for points under heavy churn (e.g. sliding-window LiDAR maps) or SE(3) trajectories: bounded memory and faster updates than prior work, with an optional asynchronous tail-latency-bounding mode. The implementation is open source: https://github.com/jlblancoc/nanoflann
Sources
- ikd-Tree: An Incremental K-D Tree for Robotic Applications
- Open3D: A Modern Library for 3D Data Processing
Related papers
- FMT x: An Efficient and Asymptotically Optimal Extension of the Fast Marching Tree for Dynamic Replanning
- MPCFormer: A physics-informed data-driven approach for explainable socially-aware autonomous driving
- RoboLab: A High-Fidelity Simulation Benchmark for Analysis of Task Generalist Policies
- ARC: A Reasoning Recipe for Robot Foundation Models
- HRDexDB: A 4D Dexterous Grasping Dataset Across Human and Multiple Robot Embodiments
- APT: Action Expert Pretraining Improves Instruction Generalization of Vision-Language-Action Policies