nanoflann:一种用于编译期乘积流形上精确最近邻搜索的仅头文件KD树库 nanoflann: A Header-Only KD-Tree Library for Exact Nearest-Neighbor Search on Compile-Time Product Manifolds 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-10-10
⬇️ 3 次下载
👁️ 预览文献
💡 AI 中文简介
在机器人等领域,许多状态空间并非欧几里得空间,例如方向位于SO(2)或SO(3)上,位姿位于SE(2)或SE(3)上。直接对这些空间的原始坐标使用欧几里得KD树会返回错误的最近邻。本文提出nanoflann,一个仅头文件、无依赖的C++ KD树库,支持在编译期声明的用户自定义乘积流形上进行精确最近邻搜索。用户通过单一类型别名组合基础流形(如R^n、SO(2)、SO(3)、S^n及其乘积SE(2)、SE(3)、环面),库会自动合成一个度量,其剪枝可证明是 admissible 的,并且对圆形坐标具有环绕感知、对单位四元数具有双覆盖感知。实验证实了精确性(在相同乘积度量下召回率为1.0,而欧几里得捷径在m个旋转块时召回率降至约0.5^m),相比暴力搜索提速高达三个数量级。此外,还贡献了一种增量式、自平衡的单树索引,适用于高变动点(如滑动窗口激光雷达地图)或SE(3)轨迹,具有有界内存和比先前工作更快的更新速度,并可选异步尾延迟限制模式。代码已开源。
领域机器人学/计算机视觉中的几何计算与数据结构
适合谁读需要一定专业背景(机器人、几何计算或C++编程经验)
核心贡献1. 首个支持编译期声明乘积流形(如SO(3)、SE(3))的仅头文件KD树库,自动合成可证明admissible的度量,实现精确最近邻搜索;2. 提出增量式自平衡单树索引,支持高变动数据,具有有界内存和快速更新,并可选异步尾延迟限制。
关键数据召回率1.0(与穷举扫描一致),欧几里得捷径召回率约0.5^m(m为旋转块数),相比暴力搜索提速高达三个数量级。
推荐理由如果你在机器人或几何计算中处理旋转和位姿的最近邻搜索,这个库能让你用一行类型别名就获得精确且高效的KD树,避免欧几里得近似带来的错误。
关键词["最近邻搜索", "KD树", "乘积流形", "精确搜索", "C++库", "机器人"]

原文摘要

查看英文原文摘要

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 ($\mathbb{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 $\approx 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