small_gicp
Public Types | Public Member Functions | Public Attributes | List of all members
small_gicp::UnsafeKdTree< PointCloud, Projection_ > Struct Template Reference

"Unsafe" KdTree. More...

#include <kdtree.hpp>

Collaboration diagram for small_gicp::UnsafeKdTree< PointCloud, Projection_ >:
Collaboration graph
[legend]

Public Types

using Projection = Projection_
 
using Node = KdTreeNode< Projection >
 

Public Member Functions

template<typename Builder = KdTreeBuilder>
 UnsafeKdTree (const PointCloud &points, const Builder &builder=KdTreeBuilder())
 Constructor. More...
 
size_t nearest_neighbor_search (const Eigen::Vector4d &query, size_t *k_indices, double *k_sq_dists, const KnnSetting &setting=KnnSetting()) const
 Find the nearest neighbor. More...
 
size_t knn_search (const Eigen::Vector4d &query, int k, size_t *k_indices, double *k_sq_dists, const KnnSetting &setting=KnnSetting()) const
 Find k-nearest neighbors. This method uses dynamic memory allocation. More...
 
template<int N>
size_t knn_search (const Eigen::Vector4d &query, size_t *k_indices, double *k_sq_dists, const KnnSetting &setting=KnnSetting()) const
 Find k-nearest neighbors. This method uses fixed and static memory allocation. Might be faster for small k. More...
 

Public Attributes

const PointCloudpoints
 Input points. More...
 
std::vector< size_t > indices
 Point indices refered by nodes. More...
 
NodeIndexType root
 Root node index (should be zero) More...
 
std::vector< Nodenodes
 Kd-tree nodes. More...
 

Detailed Description

template<typename PointCloud, typename Projection_ = AxisAlignedProjection>
struct small_gicp::UnsafeKdTree< PointCloud, Projection_ >

"Unsafe" KdTree.

Note
This class does not hold the ownership of the input points. You must keep the input points along with this class.

Member Typedef Documentation

◆ Node

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
using small_gicp::UnsafeKdTree< PointCloud, Projection_ >::Node = KdTreeNode<Projection>

◆ Projection

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
using small_gicp::UnsafeKdTree< PointCloud, Projection_ >::Projection = Projection_

Constructor & Destructor Documentation

◆ UnsafeKdTree()

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
template<typename Builder = KdTreeBuilder>
small_gicp::UnsafeKdTree< PointCloud, Projection_ >::UnsafeKdTree ( const PointCloud points,
const Builder &  builder = KdTreeBuilder() 
)
inlineexplicit

Constructor.

Parameters
pointsPoint cloud
builderKd-tree builder

Member Function Documentation

◆ knn_search() [1/2]

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
size_t small_gicp::UnsafeKdTree< PointCloud, Projection_ >::knn_search ( const Eigen::Vector4d &  query,
int  k,
size_t *  k_indices,
double *  k_sq_dists,
const KnnSetting setting = KnnSetting() 
) const
inline

Find k-nearest neighbors. This method uses dynamic memory allocation.

Parameters
queryQuery point
kNumber of neighbors
k_indicesIndices of neighbors
k_sq_distsSquared distances to neighbors (sorted in ascending order)
settingKNN search setting
Returns
Number of found neighbors

◆ knn_search() [2/2]

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
template<int N>
size_t small_gicp::UnsafeKdTree< PointCloud, Projection_ >::knn_search ( const Eigen::Vector4d &  query,
size_t *  k_indices,
double *  k_sq_dists,
const KnnSetting setting = KnnSetting() 
) const
inline

Find k-nearest neighbors. This method uses fixed and static memory allocation. Might be faster for small k.

Parameters
queryQuery point
k_indicesIndices of neighbors
k_sq_distsSquared distances to neighbors (sorted in ascending order)
settingKNN search setting
Returns
Number of found neighbors

◆ nearest_neighbor_search()

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
size_t small_gicp::UnsafeKdTree< PointCloud, Projection_ >::nearest_neighbor_search ( const Eigen::Vector4d &  query,
size_t *  k_indices,
double *  k_sq_dists,
const KnnSetting setting = KnnSetting() 
) const
inline

Find the nearest neighbor.

Parameters
queryQuery point
k_indicesIndex of the nearest neighbor (uninitialized if not found)
k_sq_distsSquared distance to the nearest neighbor (uninitialized if not found)
settingKNN search setting
Returns
Number of found neighbors (0 or 1)

Member Data Documentation

◆ indices

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
std::vector<size_t> small_gicp::UnsafeKdTree< PointCloud, Projection_ >::indices

Point indices refered by nodes.

◆ nodes

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
std::vector<Node> small_gicp::UnsafeKdTree< PointCloud, Projection_ >::nodes

Kd-tree nodes.

◆ points

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
const PointCloud& small_gicp::UnsafeKdTree< PointCloud, Projection_ >::points

Input points.

◆ root

template<typename PointCloud , typename Projection_ = AxisAlignedProjection>
NodeIndexType small_gicp::UnsafeKdTree< PointCloud, Projection_ >::root

Root node index (should be zero)


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