Open3D (C++ API)  0.12.0
Data Structures | Enumerations | Functions
open3d::core::nns Namespace Reference

Data Structures

class  FaissIndex
 Faiss for nearest neighbor search. More...
 
class  FixedRadiusIndex
 FixedRadiusIndex for nearest neighbor range search. More...
 
class  MemoryAllocation
 A class for managing memory segments within a memory allocation. More...
 
class  NanoFlannIndex
 
struct  NanoFlannIndexHolder
 NanoFlann Index Holder. More...
 
struct  NanoFlannIndexHolderBase
 Base struct for Index holder. More...
 
class  NearestNeighborSearch
 A Class for nearest neighbor search. More...
 
class  NeighborSearchAllocator
 
class  NNSIndex
 

Enumerations

enum  Metric {
  L1, L2, Linf, L1,
  L2, Linf
}
 Distance metric enum. More...
 
enum  Metric {
  L1, L2, Linf, L1,
  L2, Linf
}
 Supported metrics. More...
 

Functions

template<class TReal , class TIndex >
void BuildSpatialHashTableCUDA (void *temp, size_t &temp_size, const size_t num_points, const TReal *const points, const TReal radius, const size_t points_row_splits_size, const int64_t *points_row_splits, const TIndex *hash_table_splits, const size_t hash_table_cell_splits_size, TIndex *hash_table_cell_splits, TIndex *hash_table_index)
 
template<class T >
void FixedRadiusSearchCUDA (void *temp, size_t &temp_size, int64_t *query_neighbors_row_splits, size_t num_points, const T *const points, 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, size_t hash_table_cell_splits_size, const uint32_t *const hash_table_cell_splits, const uint32_t *const hash_table_index, NeighborSearchAllocator< T > &output_allocator)
 
HOST_DEVICE size_t SpatialHash (int x, int y, int z)
 Spatial hashing function for integer coordinates. More...
 
HOST_DEVICE size_t SpatialHash (const utility::MiniVec< int, 3 > &xyz)
 
template<class TVecf >
HOST_DEVICE utility::MiniVec< int, 3 > ComputeVoxelIndex (const TVecf &pos, const typename TVecf::Scalar_t &inv_voxel_size)
 

Enumeration Type Documentation

◆ Metric [1/2]

Supported metrics.

Enumerator
L1 
L2 
Linf 
L1 
L2 
Linf 

◆ Metric [2/2]

Distance metric enum.

Enumerator
L1 
L2 
Linf 
L1 
L2 
Linf 

Function Documentation

◆ BuildSpatialHashTableCUDA()

template<class TReal , class TIndex >
void open3d::core::nns::BuildSpatialHashTableCUDA ( void *  temp,
size_t &  temp_size,
const size_t  num_points,
const TReal *const  points,
const TReal  radius,
const size_t  points_row_splits_size,
const int64_t *  points_row_splits,
const TIndex *  hash_table_splits,
const size_t  hash_table_cell_splits_size,
TIndex *  hash_table_cell_splits,
TIndex *  hash_table_index 
)

Builds a spatial hash table for a fixed radius search of 3D points.

All pointer arguments point to device memory unless stated otherwise.

Parameters
tempPointer to temporary memory. If nullptr then the required size of temporary memory will be written to temp_size and no work is done.
temp_sizeThe size of the temporary memory in bytes. This is used as an output if temp is nullptr
texture_alignmentThe texture alignment in bytes. This is used for allocating segments within the temporary memory.
num_pointsThe number of points.
pointsThe array of 3D points.
radiusThe radius that will be used for searching.
points_row_splits_sizeThe size of the points_row_splits array. The size of the array is batch_size+1.
points_row_splitsThis pointer points to host memory. Defines 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]
hash_table_splitsThis pointer points to host memory. Array 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 array storing the start of each hash table entry. The size of this array defines the size of the hash table. The hash table size is hash_table_cell_splits_size - 1.
hash_table_indexThis is an output 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.

◆ ComputeVoxelIndex()

template<class TVecf >
HOST_DEVICE utility::MiniVec<int, 3> open3d::core::nns::ComputeVoxelIndex ( const TVecf &  pos,
const typename TVecf::Scalar_t &  inv_voxel_size 
)
inline

Computes an integer voxel index for a 3D position.

Parameters
posA 3D position.
inv_voxel_sizeThe reciprocal of the voxel size

◆ FixedRadiusSearchCUDA()

template<class T >
void open3d::core::nns::FixedRadiusSearchCUDA ( void *  temp,
size_t &  temp_size,
int64_t *  query_neighbors_row_splits,
size_t  num_points,
const T *const  points,
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,
size_t  hash_table_cell_splits_size,
const uint32_t *const  hash_table_cell_splits,
const uint32_t *const  hash_table_index,
NeighborSearchAllocator< T > &  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.

All pointer arguments point to device memory unless stated otherwise.

Template Parameters
TFloating-point data type for the point positions.
OUTPUT_ALLOCATORType of the output_allocator. See output_allocator for more information.
Parameters
tempPointer to temporary memory. If nullptr then the required size of temporary memory will be written to temp_size and no work is done.
temp_sizeThe size of the temporary memory in bytes. This is used as an output if temp is nullptr
texture_alignmentThe texture alignment in bytes. This is used for allocating segments within the temporary memory.
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 may be the same array as queries.
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_splitsThis pointer points to host memory. Defines 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_splitsThis pointer points to host memory. Defines 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_splitsThis pointer points to host memory. Array 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 BuildSpatialHashTableCUDA. The row splits array describing the start and end of each cell.
hash_table_indexThis is an output of the function BuildSpatialHashTableCUDA. 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(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.

◆ SpatialHash() [1/2]

HOST_DEVICE size_t open3d::core::nns::SpatialHash ( int  x,
int  y,
int  z 
)
inline

Spatial hashing function for integer coordinates.

◆ SpatialHash() [2/2]

HOST_DEVICE size_t open3d::core::nns::SpatialHash ( const utility::MiniVec< int, 3 > &  xyz)
inline