gtsam_points
Loading...
Searching...
No Matches
vector3i_hash.hpp
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp)
3
4#pragma once
5
6#include <Eigen/Core>
7#include <boost/functional/hash/hash.hpp>
8
9namespace gtsam_points {
10
15public:
16 size_t operator()(const Eigen::Vector3i& x) const {
17 size_t seed = 0;
18 boost::hash_combine(seed, x[0]);
19 boost::hash_combine(seed, x[1]);
20 boost::hash_combine(seed, x[2]);
21 return seed;
22 }
23};
24
30public:
31 size_t operator()(const Eigen::Vector3i& x) const {
32 const size_t p1 = 9132043225175502913;
33 const size_t p2 = 7277549399757405689;
34 const size_t p3 = 6673468629021231217;
35 return static_cast<size_t>((x[0] * p1) ^ (x[1] * p2) ^ (x[2] * p3));
36 }
37};
38
39} // namespace gtsam_points
Spatial hashing function using boost::hash_combine.
Definition vector3i_hash.hpp:14
Spatial hashing function Teschner et al., "Optimized Spatial Hashing for Collision Detection of Defor...
Definition vector3i_hash.hpp:29