Open3D (C++ API)  0.12.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Attributes
open3d::core::nns::NearestNeighborSearch Class Reference

A Class for nearest neighbor search. More...

#include <NearestNeighborSearch.h>

Public Member Functions

 NearestNeighborSearch (const Tensor &dataset_points)
 
 ~NearestNeighborSearch ()
 
 NearestNeighborSearch (const NearestNeighborSearch &)=delete
 
NearestNeighborSearchoperator= (const NearestNeighborSearch &)=delete
 
bool KnnIndex ()
 
bool MultiRadiusIndex ()
 
bool FixedRadiusIndex (utility::optional< double > radius={})
 
bool HybridIndex ()
 
std::pair< Tensor, TensorKnnSearch (const Tensor &query_points, int knn)
 
std::tuple< Tensor, Tensor, TensorFixedRadiusSearch (const Tensor &query_points, double radius)
 
std::tuple< Tensor, Tensor, TensorMultiRadiusSearch (const Tensor &query_points, const Tensor &radii)
 
std::pair< Tensor, TensorHybridSearch (const Tensor &query_points, double radius, int max_knn)
 

Protected Attributes

std::unique_ptr< NanoFlannIndexnanoflann_index_
 
std::unique_ptr< FaissIndexfaiss_index_
 
std::unique_ptr< nns::FixedRadiusIndexfixed_radius_index_
 
const Tensor dataset_points_
 

Detailed Description

A Class for nearest neighbor search.

Constructor & Destructor Documentation

◆ NearestNeighborSearch() [1/2]

open3d::core::nns::NearestNeighborSearch::NearestNeighborSearch ( const Tensor dataset_points)
inline

Constructor.

Parameters
dataset_pointsDataset points for constructing search index. Must be 2D, with shape {n, d}.

◆ ~NearestNeighborSearch()

open3d::core::nns::NearestNeighborSearch::~NearestNeighborSearch ( )

◆ NearestNeighborSearch() [2/2]

open3d::core::nns::NearestNeighborSearch::NearestNeighborSearch ( const NearestNeighborSearch )
delete

Member Function Documentation

◆ FixedRadiusIndex()

bool open3d::core::nns::NearestNeighborSearch::FixedRadiusIndex ( utility::optional< double >  radius = {})

Set index for fixed-radius search.

Parameters
radiusoptional radius parameter. required for gpu fixed radius index.
Returns
Returns true if building index success, otherwise false.

◆ FixedRadiusSearch()

std::tuple< Tensor, Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::FixedRadiusSearch ( const Tensor query_points,
double  radius 
)

Perform fixed radius search. All query points share the same radius.

Parameters
query_pointsData points for querying. Must be 2D, with shape {n, d}.
radiusRadius.
Returns
Tuple of Tensors, (indices, distances, num_neighbors):
  • indicecs: Tensor of shape {total_number_of_neighbors,}, with dtype Int64.
  • distances: Tensor of shape {total_number_of_neighbors,}, same dtype with query_points.
  • num_neighbors: Tensor of shape {n,}, with dtype Int64.

◆ HybridIndex()

bool open3d::core::nns::NearestNeighborSearch::HybridIndex ( )

Set index for hybrid search.

Returns
Returns true if building index success, otherwise false.

◆ HybridSearch()

std::pair< Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::HybridSearch ( const Tensor query_points,
double  radius,
int  max_knn 
)

Perform hybrid search.

Parameters
query_pointsData points for querying. Must be 2D, with shape {n, d}.
radiusRadius.
max_knnMaximum number of neighbor to search per query.
Returns
Pair of Tensors, (indices, distances):
  • indices: Tensor of shape {n, knn}, with dtype Int64.
  • distainces: Tensor of shape {n, knn}, with same dtype with query_points.

◆ KnnIndex()

bool open3d::core::nns::NearestNeighborSearch::KnnIndex ( )

Set index for knn search.

Returns
Returns true if building index success, otherwise false.

◆ KnnSearch()

std::pair< Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::KnnSearch ( const Tensor query_points,
int  knn 
)

Perform knn search.

Parameters
query_pointsQuery points. Must be 2D, with shape {n, d}.
knnNumber of neighbors to search per query point.
Returns
Pair of Tensors, (indices, distances):
  • indices: Tensor of shape {n, knn}, with dtype Int64.
  • distainces: Tensor of shape {n, knn}, same dtype with query_points.

◆ MultiRadiusIndex()

bool open3d::core::nns::NearestNeighborSearch::MultiRadiusIndex ( )

Set index for multi-radius search.

Returns
Returns true if building index success, otherwise false.

◆ MultiRadiusSearch()

std::tuple< Tensor, Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::MultiRadiusSearch ( const Tensor query_points,
const Tensor radii 
)

Perform multi-radius search. Each query point has an independent radius.

Parameters
query_pointsQuery points. Must be 2D, with shape {n, d}.
radiiRadii of query points. Each query point has one radius. Must be 1D, with shape {n,}.
Returns
Tuple of Tensors, (indices,distances, num_neighbors):
  • indicecs: Tensor of shape {total_number_of_neighbors,}, with dtype Int64.
  • distances: Tensor of shape {total_number_of_neighbors,}, same dtype with query_points.
  • num_neighbors: Tensor of shape {n,}, with dtype Int64.

◆ operator=()

NearestNeighborSearch& open3d::core::nns::NearestNeighborSearch::operator= ( const NearestNeighborSearch )
delete

Field Documentation

◆ dataset_points_

const Tensor open3d::core::nns::NearestNeighborSearch::dataset_points_
protected

◆ faiss_index_

std::unique_ptr<FaissIndex> open3d::core::nns::NearestNeighborSearch::faiss_index_
protected

◆ fixed_radius_index_

std::unique_ptr<nns::FixedRadiusIndex> open3d::core::nns::NearestNeighborSearch::fixed_radius_index_
protected

◆ nanoflann_index_

std::unique_ptr<NanoFlannIndex> open3d::core::nns::NearestNeighborSearch::nanoflann_index_
protected

The documentation for this class was generated from the following files: