PointHashGridUtils.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_POINT_HASH_GRID_UTILS_HPP
12 #define CUBBYFLOW_POINT_HASH_GRID_UTILS_HPP
13 
14 #include <Core/Matrix/Matrix.hpp>
15 
16 namespace CubbyFlow
17 {
21 template <size_t N>
23 {
24  public:
25  template <size_t M = N>
26  static std::enable_if_t<M == 2, size_t> HashKey(
27  const Vector<ssize_t, 2>& index, const Vector<ssize_t, 2>& resolution);
28 
29  template <size_t M = N>
30  static std::enable_if_t<M == 3, size_t> HashKey(
31  const Vector<ssize_t, 3>& index, const Vector<ssize_t, 3>& resolution);
32 
41  static size_t GetHashKeyFromBucketIndex(
42  const Vector<ssize_t, N>& bucketIndex,
43  const Vector<ssize_t, N>& resolution);
44 
54  double gridSpacing);
55 
56  static size_t GetHashKeyFromPosition(const Vector<double, N>& position,
57  double gridSpacing,
58  const Vector<ssize_t, N>& resolution);
59 
60  static void GetNearbyKeys(const Vector<double, N>& position,
61  double gridSpacing,
62  const Vector<ssize_t, N>& resolution,
63  size_t* nearbyKeys);
64 };
65 
67 
69 } // namespace CubbyFlow
70 
71 #endif
static void GetNearbyKeys(const Vector< double, N > &position, double gridSpacing, const Vector< ssize_t, N > &resolution, size_t *nearbyKeys)
static size_t GetHashKeyFromBucketIndex(const Vector< ssize_t, N > &bucketIndex, const Vector< ssize_t, N > &resolution)
static Vector< ssize_t, N > GetBucketIndex(const Vector< double, N > &position, double gridSpacing)
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
static std::enable_if_t< M==2, size_t > HashKey(const Vector< ssize_t, 2 > &index, const Vector< ssize_t, 2 > &resolution)
static size_t GetHashKeyFromPosition(const Vector< double, N > &position, double gridSpacing, const Vector< ssize_t, N > &resolution)
Hash grid common utilities for N-D point searchers.
Definition: PointHashGridUtils.hpp:22