Open3D (C++ API)
0.19.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp
open3d
core
nns
NeighborSearchCommon.h
Go to the documentation of this file.
1
// ----------------------------------------------------------------------------
2
// - Open3D: www.open3d.org -
3
// ----------------------------------------------------------------------------
4
// Copyright (c) 2018-2024 www.open3d.org
5
// SPDX-License-Identifier: MIT
6
// ----------------------------------------------------------------------------
7
8
#pragma once
9
10
#include <memory>
11
12
#include "
open3d/utility/MiniVec.h
"
13
14
namespace
open3d
{
15
namespace
core
{
16
namespace
nns
{
17
19
enum
Metric
{
L1
,
L2
,
Linf
};
20
21
#ifdef __CUDACC__
22
#define HOST_DEVICE __host__ __device__
23
#else
24
#define HOST_DEVICE
25
#endif
26
28
HOST_DEVICE
inline
size_t
SpatialHash
(
int
x,
int
y,
int
z) {
29
return
x * 73856096 ^ y * 193649663 ^ z * 83492791;
30
}
31
32
HOST_DEVICE
inline
size_t
SpatialHash
(
const
utility::MiniVec<int, 3>
&xyz) {
33
return
SpatialHash
(xyz[0], xyz[1], xyz[2]);
34
}
35
41
template
<
class
TVecf>
42
HOST_DEVICE
inline
utility::MiniVec<int, 3>
ComputeVoxelIndex
(
43
const
TVecf &pos,
const
typename
TVecf::Scalar_t &inv_voxel_size) {
44
TVecf ref_coord = pos * inv_voxel_size;
45
46
utility::MiniVec<int, 3>
voxel_index;
47
voxel_index = floor(ref_coord).template cast<int>();
48
return
voxel_index;
49
}
50
#undef HOST_DEVICE
51
53
struct
NanoFlannIndexHolderBase
{
54
virtual
~NanoFlannIndexHolderBase
() {}
55
};
56
57
}
// namespace nns
58
}
// namespace core
59
}
// namespace open3d
MiniVec.h
HOST_DEVICE
#define HOST_DEVICE
Definition
NeighborSearchCommon.h:24
open3d::core::nns
Definition
FixedRadiusIndex.cpp:16
open3d::core::nns::ComputeVoxelIndex
HOST_DEVICE utility::MiniVec< int, 3 > ComputeVoxelIndex(const TVecf &pos, const typename TVecf::Scalar_t &inv_voxel_size)
Definition
NeighborSearchCommon.h:42
open3d::core::nns::Metric
Metric
Supported metrics.
Definition
NeighborSearchCommon.h:19
open3d::core::nns::Linf
@ Linf
Definition
NeighborSearchCommon.h:19
open3d::core::nns::L1
@ L1
Definition
NeighborSearchCommon.h:19
open3d::core::nns::L2
@ L2
Definition
NeighborSearchCommon.h:19
open3d::core::nns::SpatialHash
HOST_DEVICE size_t SpatialHash(int x, int y, int z)
Spatial hashing function for integer coordinates.
Definition
NeighborSearchCommon.h:28
open3d::core
Definition
AdvancedIndexing.cpp:15
open3d
Definition
PinholeCameraIntrinsic.cpp:16
open3d::core::nns::NanoFlannIndexHolderBase
Base struct for NanoFlann index holder.
Definition
NeighborSearchCommon.h:53
open3d::core::nns::NanoFlannIndexHolderBase::~NanoFlannIndexHolderBase
virtual ~NanoFlannIndexHolderBase()
Definition
NeighborSearchCommon.h:54
open3d::utility::MiniVec
Definition
MiniVec.h:24
Generated by
1.17.0