Comparison

Feature comparison based on kd3 1.5.0 and nanoflann 1.10.0. kd3 targets static low-dimensional clouds; nanoflann covers a broader feature set. Colors indicate advantage in this comparison, not simply whether a feature exists.

kd3 is stronger for

  • Static 2D-4D point clouds, especially near-data queries.
  • Volume and ray queries when subtree bounds are enabled.
  • First-class filtered 1-NN, k-NN, and distance queries.
  • Caller-owned k-NN buffers and a trivially copyable view.
  • C API, GLSL generator, and header-only C++23.

nanoflann is stronger for

  • Radius, approximate, and custom-metric search.
  • Dynamic, incremental, and runtime-dimensional indexes.
  • Non-owning adaptors and built-in index serialization.
  • C++11 compatibility and no OpenMP requirement.
  • A permissive BSD licence and a mature ecosystem.
Capabilitykd3 1.5nanoflann 1.10
Index and search
Static kd-treeYesYes
Dynamic add/removeNoYes
Incremental / self-balancing treeNoYes
Async / multi-threaded incremental variantNoYes
Compile-time dimensionalityYesYes
Runtime dimensionalityNoYes
1-NNYesYes
k-NNYesYes
Radius searchNoYes
Radius-limited k-NNNoYes
Approximate searchNoYes
Custom result setNoYes
Custom distance metricNoYes
Filtered queriesYesPartial
Ray / cylinder queryYesNo
Tie-break controlNoYes
Parallel buildYesLimited
Index serializationBuffer copyYes
Query-time allocationNoneDIM-dependent
Data, layout, and API
Data ownershipOwningNon-owning
Mutates input during buildYesNo
Arbitrary data source / adaptorNoYes
SoA leaf layoutYesNo
Hand-written SIMD kernelsOpt-inNo
Per-subtree AABB toggleYesNo
Trivially copyable query viewYesNo
Built-in C APIYesNo
GLSL / shader generatorYesNo
Header-onlyYesYes
Required C++ standardC++23C++11
OpenMP requiredBuild-timeNo
LicenceAGPL-3.0-only or commercialBSD-2-Clause
Primary tuning targetStatic low-DGeneral-purpose

Performance is configuration-dependent. kd3 wins clearly on near-data queries and on volume queries with AABB enabled; nanoflann remains the broader library. nanoflann's parallel build is present, but a global lock limits scalability. The benchmark page lists every measured row.

kd3 is a static index. The repository includes a small compaction-based mutable wrapper in examples/mutable with an optional delta tree and bulk creation. It adds insert/erase/kNN around KdTreeView without changing the core index. The mutable benchmark validates it against nanoflann's dynamic adaptors. Dynamic support is not built in, but the wrapper is deliberately small.