Loading...
Searching...
No Matches
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
15
16namespace CubbyFlow
17{
21template <size_t N>
23{
24 public:
25 template <size_t M = N>
26 static std::enable_if_t<M == 2, size_t> HashKey(
28
29 template <size_t M = N>
30 static std::enable_if_t<M == 3, size_t> HashKey(
32
44
54 double gridSpacing);
55
57 double gridSpacing,
59
61 double gridSpacing,
63 size_t* nearbyKeys);
64};
65
67
69} // namespace CubbyFlow
70
71#endif
Definition Matrix.hpp:30
Hash grid common utilities for N-D point searchers.
Definition PointHashGridUtils.hpp:23
static std::enable_if_t< M==3, size_t > HashKey(const Vector< ssize_t, 3 > &index, const Vector< ssize_t, 3 > &resolution)
static size_t GetHashKeyFromPosition(const Vector< double, N > &position, double gridSpacing, const Vector< ssize_t, N > &resolution)
static std::enable_if_t< M==2, size_t > HashKey(const Vector< ssize_t, 2 > &index, const Vector< ssize_t, 2 > &resolution)
static Vector< ssize_t, N > GetBucketIndex(const Vector< double, N > &position, double gridSpacing)
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)
Definition pybind11Utils.hpp:21