Open3D (C++ API)  0.18.0+5c982c7
Functions
open3d::core::nns::impl Namespace Reference

Functions

template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void FixedRadiusSearchCPU (int64_t *query_neighbors_row_splits, const size_t num_points, const T *const points, const size_t num_queries, const T *const queries, const T radius, const size_t points_row_splits_size, const int64_t *const points_row_splits, const size_t queries_row_splits_size, const int64_t *const queries_row_splits, const uint32_t *const hash_table_splits, const size_t hash_table_cell_splits_size, const uint32_t *const hash_table_cell_splits, const uint32_t *const hash_table_index, const Metric metric, const bool ignore_query_point, const bool return_distances, OUTPUT_ALLOCATOR &output_allocator)
 
template<class T , class TIndex >
std::unique_ptr< NanoFlannIndexHolderBaseBuildKdTree (size_t num_points, const T *const points, size_t dimension, const Metric metric)
 
template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void KnnSearchCPU (NanoFlannIndexHolderBase *holder, int64_t *query_neighbors_row_splits, size_t num_points, const T *const points, size_t num_queries, const T *const queries, const size_t dimension, int knn, const Metric metric, bool ignore_query_point, bool return_distances, OUTPUT_ALLOCATOR &output_allocator)
 
template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void RadiusSearchCPU (NanoFlannIndexHolderBase *holder, int64_t *query_neighbors_row_splits, size_t num_points, const T *const points, size_t num_queries, const T *const queries, const size_t dimension, const T *const radii, const Metric metric, bool ignore_query_point, bool return_distances, bool normalize_distances, bool sort, OUTPUT_ALLOCATOR &output_allocator)
 
template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void HybridSearchCPU (NanoFlannIndexHolderBase *holder, size_t num_points, const T *const points, size_t num_queries, const T *const queries, const size_t dimension, const T radius, const int max_knn, const Metric metric, bool ignore_query_point, bool return_distances, OUTPUT_ALLOCATOR &output_allocator)
 

Function Documentation

◆ BuildKdTree()

template<class T , class TIndex >
std::unique_ptr<NanoFlannIndexHolderBase> open3d::core::nns::impl::BuildKdTree ( size_t  num_points,
const T *const  points,
size_t  dimension,
const Metric  metric 
)

Build KD Tree. This function build a KDTree for given dataset points.

Template Parameters
TFloating-point data type for the point positions.
Parameters
num_pointsThe number of points.
pointsArray with the point positions.
dimensionThe dimension of points.
metricOnf of L1, L2. Defines the distance metric for the search

◆ FixedRadiusSearchCPU()

template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void open3d::core::nns::impl::FixedRadiusSearchCPU ( int64_t *  query_neighbors_row_splits,
const size_t  num_points,
const T *const  points,
const size_t  num_queries,
const T *const  queries,
const T  radius,
const size_t  points_row_splits_size,
const int64_t *const  points_row_splits,
const size_t  queries_row_splits_size,
const int64_t *const  queries_row_splits,
const uint32_t *const  hash_table_splits,
const size_t  hash_table_cell_splits_size,
const uint32_t *const  hash_table_cell_splits,
const uint32_t *const  hash_table_index,
const Metric  metric,
const bool  ignore_query_point,
const bool  return_distances,
OUTPUT_ALLOCATOR &  output_allocator 
)

Fixed radius search. This function computes a list of neighbor indices for each query point. The lists are stored linearly and an exclusive prefix sum defines the start and end of list in the array. In addition the function optionally can return the distances for each neighbor in the same format as the indices to the neighbors.

Template Parameters
TFloating-point data type for the point positions.
OUTPUT_ALLOCATORType of the output_allocator. See output_allocator for more information.
Parameters
query_neighbors_row_splitsThis is the output pointer for the prefix sum. The length of this array is num_queries + 1.
num_pointsThe number of points.
pointsArray with the 3D point positions. This must be the array that was used for building the spatial hash table.
num_queriesThe number of query points.
queriesArray with the 3D query positions. This may be the same array as points.
radiusThe search radius.
points_row_splits_sizeThe size of the points_row_splits array. The size of the array is batch_size+1.
points_row_splitsDefines the start and end of the points in each batch item. The size of the array is batch_size+1. If there is only 1 batch item then this array is [0, num_points]
queries_row_splits_sizeThe size of the queries_row_splits array. The size of the array is batch_size+1.
queries_row_splitsDefines the start and end of the queries in each batch item. The size of the array is batch_size+1. If there is only 1 batch item then this array is [0, num_queries]
hash_table_splitsArray defining the start and end the hash table for each batch item. This is [0, number of cells] if there is only 1 batch item or [0, hash_table_cell_splits_size-1] which is the same.
hash_table_cell_splits_sizeThis is the length of the hash_table_cell_splits array.
hash_table_cell_splitsThis is an output of the function BuildSpatialHashTableCPU. The row splits array describing the start and end of each cell.
hash_table_indexThis is an output of the function BuildSpatialHashTableCPU. This is array storing the values of the hash table, which are the indices to the points. The size of the array must be equal to the number of points.
metricOne of L1, L2, Linf. Defines the distance metric for the search.
ignore_query_pointIf true then points with the same position as the query point will be ignored.
return_distancesIf true then this function will return the distances for each neighbor to its query point in the same format as the indices. Note that for the L2 metric the squared distances will be returned!!
output_allocatorAn object that implements functions for allocating the output arrays. The object must implement functions AllocIndices(int64_t** ptr, size_t size) and AllocDistances(T** ptr, size_t size). Both functions should allocate memory and return a pointer to that memory in ptr. Argument size specifies the size of the array as the number of elements. Both functions must accept the argument size==0. In this case ptr does not need to be set.

◆ HybridSearchCPU()

template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void open3d::core::nns::impl::HybridSearchCPU ( NanoFlannIndexHolderBase holder,
size_t  num_points,
const T *const  points,
size_t  num_queries,
const T *const  queries,
const size_t  dimension,
const T  radius,
const int  max_knn,
const Metric  metric,
bool  ignore_query_point,
bool  return_distances,
OUTPUT_ALLOCATOR &  output_allocator 
)

Hybrid search. This function computes a list of neighbor indices for each query point. The lists are stored linearly and an exclusive prefix sum defines the start and end of each list in the array. In addition the function optionally can return the distances for each neighbor in the same format as the indices to the neighbors.

Template Parameters
TFloating-point data type for the point positions.
OUTPUT_ALLOCATORType of the output_allocator. See output_allocator for more information.
Parameters
holderThe pointer that point to NanFlannIndexHolder that is built with BuildKdTree function.
num_pointsThe number of points.
pointsArray with the point positions. This may be the same array as queries.
num_queriesThe number of query points.
queriesArray with the query positions. This may be the same array as points.
dimensionThe dimension of points and queries.
radiusThe radius value that defines the neighbors region.
max_knnThe maximum number of neighbors to search.
metricOne of L1, L2. Defines the distance metric for the search.
ignore_query_pointIf true then points with the same position as the query point will be ignored.
return_distancesIf true then this function will return the distances for each neighbor to its query point in the same format as the indices. Note that for the L2 metric the squared distances will be returned!!
output_allocatorAn object that implements functions for allocating the output arrays. The object must implement functions AllocIndices(int32_t** ptr, size_t size) and AllocDistances(T** ptr, size_t size). Both functions should allocate memory and return a pointer to that memory in ptr. Argument size specifies the size of the array as the number of elements. Both functions must accept the argument size==0. In this case ptr does not need to be set.

◆ KnnSearchCPU()

template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void open3d::core::nns::impl::KnnSearchCPU ( NanoFlannIndexHolderBase holder,
int64_t *  query_neighbors_row_splits,
size_t  num_points,
const T *const  points,
size_t  num_queries,
const T *const  queries,
const size_t  dimension,
int  knn,
const Metric  metric,
bool  ignore_query_point,
bool  return_distances,
OUTPUT_ALLOCATOR &  output_allocator 
)

KNN search. This function computes a list of neighbor indices for each query point. The lists are stored linearly and an exclusive prefix sum defines the start and end of each list in the array. In addition the function optionally can return the distances for each neighbor in the same format as the indices to the neighbors.

Template Parameters
TFloating-point data type for the point positions.
OUTPUT_ALLOCATORType of the output_allocator. See output_allocator for more information.
Parameters
holderThe pointer that point to NanFlannIndexHolder that is built with BuildKdTree function.
query_neighbors_row_splitsThis is the output pointer for the prefix sum. The length of this array is num_queries + 1.
num_pointsThe number of points.
pointsArray with the point positions. This may be the same array as queries.
num_queriesThe number of query points.
queriesArray with the query positions. This may be the same array as points.
dimensionThe dimension of points and queries.
knnThe number of neighbors to search.
metricOne of L1, L2. Defines the distance metric for the search.
ignore_query_pointIf true then points with the same position as the query point will be ignored.
return_distancesIf true then this function will return the distances for each neighbor to its query point in the same format as the indices. Note that for the L2 metric the squared distances will be returned!!
output_allocatorAn object that implements functions for allocating the output arrays. The object must implement functions AllocIndices(int32_t** ptr, size_t size) and AllocDistances(T** ptr, size_t size). Both functions should allocate memory and return a pointer to that memory in ptr. Argument size specifies the size of the array as the number of elements. Both functions must accept the argument size==0. In this case ptr does not need to be set.

◆ RadiusSearchCPU()

template<class T , class TIndex , class OUTPUT_ALLOCATOR >
void open3d::core::nns::impl::RadiusSearchCPU ( NanoFlannIndexHolderBase holder,
int64_t *  query_neighbors_row_splits,
size_t  num_points,
const T *const  points,
size_t  num_queries,
const T *const  queries,
const size_t  dimension,
const T *const  radii,
const Metric  metric,
bool  ignore_query_point,
bool  return_distances,
bool  normalize_distances,
bool  sort,
OUTPUT_ALLOCATOR &  output_allocator 
)

Radius search. This function computes a list of neighbor indices for each query point. The lists are stored linearly and an exclusive prefix sum defines the start and end of each list in the array. In addition the function optionally can return the distances for each neighbor in the same format as the indices to the neighbors.

Template Parameters
TFloating-point data type for the point positions.
OUTPUT_ALLOCATORType of the output_allocator. See output_allocator for more information.
Parameters
holderThe pointer that point to NanFlannIndexHolder that is built with BuildKdTree function.
query_neighbors_row_splitsThis is the output pointer for the prefix sum. The length of this array is num_queries + 1.
num_pointsThe number of points.
pointsArray with the point positions. This may be the same array as queries.
num_queriesThe number of query points.
queriesArray with the query positions. This may be the same array as points.
dimensionThe dimension of points and queries.
radiiA vector of search radii with length num_queries.
metricOne of L1, L2. Defines the distance metric for the search.
ignore_query_pointIf true then points with the same position as the query point will be ignored.
return_distancesIf true then this function will return the distances for each neighbor to its query point in the same format as the indices. Note that for the L2 metric the squared distances will be returned!!
normalize_distancesIf true then the returned distances are normalized in the range [0,1]. Note that for L2 the normalized distance is squared.
sortIf true then sort the resulting indices and distances in ascending order of distances.
output_allocatorAn object that implements functions for allocating the output arrays. The object must implement functions AllocIndices(int32_t** ptr, size_t size) and AllocDistances(T** ptr, size_t size). Both functions should allocate memory and return a pointer to that memory in ptr. Argument size specifies the size of the array as the number of elements. Both functions must accept the argument size==0. In this case ptr does not need to be set.