gtsam_points
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
gtsam_points::KdTree2< Frame > Struct Template Reference

KdTree-based nearest neighbor search. More...

#include <kdtree2.hpp>

Inheritance diagram for gtsam_points::KdTree2< Frame >:
Inheritance graph
[legend]
Collaboration diagram for gtsam_points::KdTree2< Frame >:
Collaboration graph
[legend]

Public Types

using Index = UnsafeKdTree< Frame >
 
- Public Types inherited from gtsam_points::NearestNeighborSearch
using Ptr = std::shared_ptr< NearestNeighborSearch >
 
using ConstPtr = std::shared_ptr< const NearestNeighborSearch >
 

Public Member Functions

 KdTree2 (const std::shared_ptr< const Frame > &frame, int build_num_threads=1)
 
virtual size_t knn_search (const double *pt, size_t k, size_t *k_indices, double *k_sq_dists, double max_sq_dist=std::numeric_limits< double >::max()) const override
 Find k nearest neighbors.
 
virtual size_t radius_search (const double *pt, double radius, std::vector< size_t > &indices, std::vector< double > &sq_dists, int max_num_neighbors=std::numeric_limits< int >::max()) const override
 Radius search.
 

Public Attributes

const std::shared_ptr< const Frame > frame
 
double search_eps
 
std::unique_ptr< Index > index
 

Detailed Description

template<typename Frame>
struct gtsam_points::KdTree2< Frame >

KdTree-based nearest neighbor search.

Member Function Documentation

◆ knn_search()

template<typename Frame >
virtual size_t gtsam_points::KdTree2< Frame >::knn_search ( const double *  pt,
size_t  k,
size_t *  k_indices,
double *  k_sq_dists,
double  max_sq_dist = std::numeric_limits<double>::max() 
) const
inlineoverridevirtual

Find k nearest neighbors.

Parameters
ptQuery point (must be 4D vector [x, y, z, 1])
kNumber of neighbors to search
k_indicesIndices of k nearest neighbors
k_sq_distsSquared distances of k nearest neighbors
Returns
Number of neighbors found

Reimplemented from gtsam_points::NearestNeighborSearch.

◆ radius_search()

template<typename Frame >
virtual size_t gtsam_points::KdTree2< Frame >::radius_search ( const double *  pt,
double  radius,
std::vector< size_t > &  indices,
std::vector< double > &  sq_dists,
int  max_num_neighbors = std::numeric_limits<int>::max() 
) const
inlineoverridevirtual

Radius search.

Note
There is no assumption and guarantee on the order of points to be selected when max_num_neighbors is specified. (KdTree tends to first pick closer points though).
Parameters
ptPoint
radiusSearch radius
indicesIndices of neighbors within the radius
sq_distsSquared distances to the neighbors
max_num_neighborsMaximum number of neighbors
Returns
Number of neighbors

Reimplemented from gtsam_points::NearestNeighborSearch.


The documentation for this struct was generated from the following file: