|
| | KDTreeSingleIndexIncrementalAdaptor (const Dimension dimensionality, const DatasetAdaptor &inputData, const KDTreeIncrementalIndexParams ¶ms={}) |
| | KDTreeSingleIndexIncrementalAdaptor (const KDTreeSingleIndexIncrementalAdaptor &)=delete |
|
KDTreeSingleIndexIncrementalAdaptor & | operator= (const KDTreeSingleIndexIncrementalAdaptor &)=delete |
| void | addPoint (IndexType idx) |
| void | addPoints (IndexType start, IndexType end) |
| void | removePoint (IndexType idx) |
| void | removeBox (const BoundingBox &box) |
| void | removeOutsideBox (const BoundingBox &keep) |
| void | setCollectRemovedPoints (bool enable) |
| std::vector< IndexType > | acquireRemovedPoints () |
| void | setInlineRebuild (bool enable) |
| void | snapshotLiveIndices (std::vector< IndexType > &out) const |
| void | collectPhysicalIndices (std::vector< IndexType > &out) const |
| NANOFLANN_NODISCARD bool | referencesIndex (IndexType idx) const |
| void | buildFromIndices (const std::vector< IndexType > &idxs) |
| NANOFLANN_NODISCARD Size | size () const noexcept |
|
NANOFLANN_NODISCARD bool | empty () const noexcept |
| NANOFLANN_NODISCARD Size | physicalSize () const noexcept |
| NANOFLANN_NODISCARD Size | usedMemory () const |
| NANOFLANN_NODISCARD BoundingBox | boundingBox () const |
| void | reserve (Size n) |
| template<typename RESULTSET> |
| bool | findNeighbors (RESULTSET &result, const ElementType *vec, const SearchParameters &searchParams={}) const |
| NANOFLANN_NODISCARD Size | knnSearch (const ElementType *query_point, const Size num_closest, IndexType *out_indices, DistanceType *out_distances, const SearchParameters &searchParams={}) const |
| NANOFLANN_NODISCARD Size | radiusSearch (const ElementType *query_point, const DistanceType &radius, std::vector< ResultItem< IndexType, DistanceType > > &IndicesDists, const SearchParameters &searchParams={}) const |
| template<class SEARCH_CALLBACK> |
| NANOFLANN_NODISCARD Size | radiusSearchCustomCallback (const ElementType *query_point, SEARCH_CALLBACK &resultSet, const SearchParameters &searchParams={}) const |
| NANOFLANN_NODISCARD Size | rknnSearch (const ElementType *query_point, const Size num_closest, IndexType *out_indices, DistanceType *out_distances, const DistanceType &radius) const |
| template<typename RESULTSET> |
| NANOFLANN_NODISCARD Size | findWithinBox (RESULTSET &result, const BoundingBox &bbox) const |
| void | freeIndex (KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj) |
| NANOFLANN_NODISCARD Size | size (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj) const noexcept |
| NANOFLANN_NODISCARD Size | veclen (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj) const noexcept |
|
ElementType | dataset_get (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, IndexType element, Dimension component) const |
| | Helper accessor to the dataset points:
|
| NANOFLANN_NODISCARD Size | usedMemory (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj) const |
| void | computeMinMax (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, Offset ind, Size count, Dimension element, ElementType &min_elem, ElementType &max_elem) const |
| NANOFLANN_NODISCARD bool | isActive (IndexType) const |
| void | computeBoundingBox (BoundingBox &bbox) |
| bool | searchLevel (RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindist, distance_vector_t &dists, const DistanceType epsError) const |
| bool | makeNode (KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, NodePtr node, const Offset left, const Offset right, BoundingBox &bbox, Offset &idx, Dimension &cutfeat, DistanceType &cutval) |
| void | finalizeSplitNode (KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, NodePtr node, const Dimension cutfeat, const BoundingBox &left_bbox, const BoundingBox &right_bbox, BoundingBox &bbox) |
|
NodePtr | divideTree (KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, const Offset left, const Offset right, BoundingBox &bbox) |
| NodePtr | divideTreeConcurrent (KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, const Offset left, const Offset right, BoundingBox &bbox, std::atomic< unsigned int > &thread_count, std::mutex &mutex) |
|
void | middleSplit_ (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, const Offset ind, const Size count, Offset &index, Dimension &cutfeat, DistanceType &cutval, const BoundingBox &bbox) |
| void | planeSplit (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, const Offset ind, const Size count, const Dimension cutfeat, const DistanceType &cutval, Offset &lim1, Offset &lim2) |
|
DistanceType | computeInitialDistances (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, const ElementType *vec, distance_vector_t &dists) const |
| void | saveIndex (const KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, std::ostream &stream) const |
| void | loadIndex (KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, -1, uint32_t > &obj, std::istream &stream) |
template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
class nanoflann::KDTreeSingleIndexIncrementalAdaptor< Distance, DatasetAdaptor, DIM, IndexType >
kd-tree incremental dynamic index — a single, self-balancing k-d tree.
This is an additive alternative to KDTreeSingleIndexDynamicAdaptor (the "logarithmic forest"). Instead of maintaining O(log N) static sub-trees, it keeps a single weight-balanced k-d tree that supports cheap incremental point insertion, lazy point removal, and pruned axis-aligned box deletions (removeBox / removeOutsideBox), the latter being the primary map-maintenance primitive used in LiDAR odometry (keep a local cube around the sensor and discard everything outside it as the platform moves).
Compared with the forest, the single tree avoids the multiplicative O(log N) query penalty of querying every sub-tree, and keeps deletion garbage bounded (a subtree is rebuilt once its dead fraction crosses alpha_deleted), at the price of synchronous O(N) rebuild spikes near the root.
Like the other adaptors this is zero-copy: the data points live in the user-provided dataset; the tree only stores point indices. Each tree node holds a single point plus augmentation (subtree size, tombstone count and an axis-aligned bounding box) used to prune the box-region operations.
- Note
- Threading: like the rest of nanoflann, const queries are safe for concurrent readers, but mutating operations (addPoints / removePoint / removeBox / removeOutsideBox) must not run concurrently with any query.
-
A compile-time fixed DIM (e.g. 3 for 3D LiDAR) is recommended: the per-node bounding box is then a stack std::array and no per-node heap allocation occurs. With DIM=-1 each node's box is a std::vector.
- Template Parameters
-
| Distance | The distance metric (nanoflann::metric_L2_Simple, etc). |
| DatasetAdaptor | The user-provided dataset adaptor. |
| DIM | Dimensionality of the data points (e.g. 3), or -1 for runtime. |
| IndexType | Type used to index data points (e.g. uint32_t). |