NearestNeighborQueryEngine.hpp
Go to the documentation of this file.
1 // This code is based on Jet framework.
2 // Copyright (c) 2018 Doyub Kim
3 // CubbyFlow is voxel-based fluid simulation engine for computer games.
4 // Copyright (c) 2020 CubbyFlow Team
5 // Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6 // AI Part: Dongheon Cho, Minseo Kim
7 // We are making my contributions/submissions to this project solely in our
8 // personal capacity and are not conveying any rights to any intellectual
9 // property of any third parties.
10 
11 #ifndef CUBBYFLOW_NEAREST_NEIGHBOR_QUERY_ENGINE_HPP
12 #define CUBBYFLOW_NEAREST_NEIGHBOR_QUERY_ENGINE_HPP
13 
14 #include <Core/Matrix/Matrix.hpp>
15 
16 #include <functional>
17 #include <limits>
18 
19 namespace CubbyFlow
20 {
22 template <typename T, size_t N>
24 {
25  const T* item = nullptr;
26  double distance = std::numeric_limits<double>::max();
27 };
28 
30 template <typename T>
32 
34 template <typename T>
36 
38 template <typename T, size_t N>
40  std::function<double(const T&, const Vector<double, N>&)>;
41 
43 template <typename T>
45 
47 template <typename T>
49 
51 template <typename T, size_t N>
53 {
54  public:
56  NearestNeighborQueryEngine() = default;
57 
59  virtual ~NearestNeighborQueryEngine() = default;
60 
63  default;
64 
67  default;
68 
70  NearestNeighborQueryEngine& operator=(
71  const NearestNeighborQueryEngine& other) = default;
72 
74  NearestNeighborQueryEngine& operator=(
75  NearestNeighborQueryEngine&& other) noexcept = default;
76 
79  [[nodiscard]] virtual NearestNeighborQueryResult<T, N> Nearest(
80  const Vector<double, N>& pt,
81  const NearestNeighborDistanceFunc<T, N>& distanceFunc) const = 0;
82 };
83 
85 template <typename T>
87 
89 template <typename T>
91 } // namespace CubbyFlow
92 
93 #endif
N-D nearest neighbor query result.
Definition: NearestNeighborQueryEngine.hpp:23
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
const T * item
Definition: NearestNeighborQueryEngine.hpp:25
Abstract base class for N-D nearest neighbor query engine.
Definition: NearestNeighborQueryEngine.hpp:52
NearestNeighborDistanceFunc< T, 3 > NearestNeighborDistanceFunc3
3-D nearest neighbor distance measure function.
Definition: NearestNeighborQueryEngine.hpp:48
std::function< double(const T &, const Vector< double, N > &)> NearestNeighborDistanceFunc
N-D nearest neighbor distance measure function.
Definition: NearestNeighborQueryEngine.hpp:40
double distance
Definition: NearestNeighborQueryEngine.hpp:26
NearestNeighborDistanceFunc< T, 2 > NearestNeighborDistanceFunc2
2-D nearest neighbor distance measure function.
Definition: NearestNeighborQueryEngine.hpp:44