52 #include "super4pcs/shared4pcs.h" 61 template <
typename _Scalar>
64 using Scalar = _Scalar;
67 const uint64_t MAGIC1 = 100000007;
68 const uint64_t MAGIC2 = 161803409;
69 const uint64_t MAGIC3 = 423606823;
70 const uint64_t NO_DATA = 0xffffffffu;
73 using VoxelType = std::array<int,3>;
74 std::vector<VoxelType> voxels_;
75 std::vector<uint64_t> data_;
78 HashTable(
int maxpoints, Scalar voxel) : voxel_(voxel), scale_(1.0f / voxel) {
79 uint64_t n = maxpoints;
81 data_.resize(n, NO_DATA);
83 template <
typename Po
int>
84 uint64_t& operator[](
const Point& p) {
86 VoxelType c {int(floor(p.x() * scale_)),
87 int(floor(p.y() * scale_)),
88 int(floor(p.z() * scale_))};
90 uint64_t key = (MAGIC1 * c[0] + MAGIC2 * c[1] + MAGIC3 * c[2]) % data_.size();
92 if (data_[key] == NO_DATA) {
95 }
else if (voxels_[key] == c) {
99 if (key == data_.size()) key = 0;
105 template <
typename Po
int>
109 std::vector<Point>& output)
const {
110 int num_input = inputset.size();
112 HashTable<typename Point::Scalar> hash(num_input, options.
delta);
113 for (
int i = 0; i < num_input; i++) {
114 uint64_t& ind = hash[inputset[i]];
115 if (ind >= num_input) {
116 output.push_back(inputset[i]);
Scalar delta
The delta for the LCP (see the paper).
Definition: shared4pcs.h:153
void operator()(const std::vector< Point > &inputset, const Match4PCSOptions &options, std::vector< Point > &output) const
Definition: sampling.h:107
delta and overlap_estimation are the application parameters. All other parameters are more likely to ...
Definition: shared4pcs.h:148
Definition: sampling.h:59