56 #include <gr/utils/shared.h> 60 #ifdef PARSED_BY_DOXYGEN 70 template<
typename PointType>
72 #ifdef PARSED_BY_DOXYGEN 77 template <
typename _Point>
81 using Scalar =
typename Point::Scalar;
84 const uint64_t MAGIC1 = 100000007;
85 const uint64_t MAGIC2 = 161803409;
86 const uint64_t MAGIC3 = 423606823;
87 const uint64_t NO_DATA = 0xffffffffu;
90 using VoxelType = std::array<
int,3>;
91 std::vector<VoxelType> voxels_;
92 std::vector<uint64_t> data_;
95 HashTable(
int maxpoints, Scalar voxel) : voxel_(voxel), scale_(1.0f / voxel) {
96 uint64_t n = maxpoints;
98 data_.resize(n, NO_DATA);
100 template <
typename Point>
101 uint64_t& operator[](
const Point& p) {
103 VoxelType c {
int(floor(p.pos()(0) * scale_)),
104 int(floor(p.pos()(1) * scale_)),
105 int(floor(p.pos()(2) * scale_))};
107 uint64_t key = (MAGIC1 * c[0] + MAGIC2 * c[1] + MAGIC3 * c[2]) % data_.size();
109 if (data_[key] == NO_DATA) {
112 }
else if (voxels_[key] == c) {
116 if (key == data_.size()) key = 0;
123 template <
typename InputRange,
typename OutputRange,
class Options>
126 const Options& options,
127 OutputRange& output)
const {
128 int num_input = inputset.size();
130 HashTable<PointType> hash(num_input, options.delta);
132 for(
const auto& p : inputset) {
133 uint64_t& ind = hash[PointType(p)];
134 if (ind >= uint64_t(num_input)) {
135 output.push_back( p );
Definition: sampling.h:71
CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::Scalar ComputeTransformation(const InputRange1 &P, const InputRange2 &Q, Eigen::Ref< typename CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::MatrixType > transformation, const Sampler< PointType > &sampler, TransformVisitor &v)
Definition: congruentSetExplorationBase.hpp:61
void operator()(const InputRange &inputset, const Options &options, OutputRange &output) const
Definition: sampling.h:125