49static const std::array<std::vector<Vector3<int32_t>>, 9> adjacentPointsSearch = {{
51 {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}},
66 {{1, 1, 1}, {1, 1, -1}, {1, -1, 1}, {1, -1, -1}, {-1, 1, 1}, {-1, 1, -1}, {-1, -1, 1}, {-1, -1, -1}},
68 {{2, 0, 0}, {-2, 0, 0}, {0, 2, 0}, {0, -2, 0}, {0, 0, 2}, {0, 0, -2}},
70 {{2, 1, 0}, {2, -1, 0}, {1, 2, 0}, {1, -2, 0}, {-1, 2, 0}, {-1, -2, 0}, {-2, 1, 0}, {-2, -1, 0},
71 {0, 2, 1}, {0, 2, -1}, {0, 1, 2}, {0, 1, -2}, {0, -1, 2}, {0, -1, -2}, {0, -2, 1}, {0, -2, -1},
72 {1, 0, 2}, {-1, 0, 2}, {2, 0, 1}, {-2, 0, 1}, {2, 0, -1}, {-2, 0, -1}, {1, 0, -2}, {-1, 0, -2}},
74 {{2, 1, 1}, {2, 1, -1}, {2, -1, 1}, {2, -1, -1}, {1, 2, 1}, {1, 2, -1}, {1, 1, 2}, {1, 1, -2},
75 {1, -1, 2}, {1, -1, -2}, {1, -2, 1}, {1, -2, -1}, {-1, 2, 1}, {-1, 2, -1}, {-1, 1, 2}, {-1, 1, -2},
76 {-1, -1, 2}, {-1, -1, -2}, {-1, -2, 1}, {-1, -2, -1}, {-2, 1, 1}, {-2, 1, -1}, {-2, -1, 1}, {-2, -1, -1}},
93 {{3, 0, 0}, {-3, 0, 0}, {0, 3, 0}, {0, -3, 0}, {0, 0, 3}, {0, 0, -3}, {2, 2, 1}, {2, 2, -1}, {2, 1, 2}, {2, 1, -2},
94 {2, -1, 2}, {2, -1, -2}, {2, -2, 1}, {2, -2, -1}, {1, 2, 2}, {1, 2, -2}, {1, -2, 2}, {1, -2, -2}, {-1, 2, 2}, {-1, 2, -2},
95 {-1, -2, 2}, {-1, -2, -2}, {-2, 2, 1}, {-2, 2, -1}, {-2, 1, 2}, {-2, 1, -2}, {-2, -1, 2}, {-2, -1, -2}, {-2, -2, 1}, {-2, -2, -1}},
98template <
typename T,
typename TT>
99inline double dotProduct(
const std::array<T, 3>& arr1,
const std::array<TT, 3>& arr2) {
100 return arr1[0] * arr2[0] + arr1[1] * arr2[1] + arr1[2] * arr2[2];
110 for (
const auto& elem : vector) {
112 hash ^= hasher(elem) + 0x9e3779b9 + (hash << 6U) + (hash >> 2U);
165 std::vector<std::vector<size_t>>& voxelIdToPointsId,
166 const size_t inputBitResolution,
167 const size_t outputBitResolution)
169 Logger::log<LogLevel::TRACE>(
"PATCH GENERATION",
170 "Voxelization from " + std::to_string(inputBitResolution) +
" to " + std::to_string(outputBitResolution) +
" bits of resolution.\n");
172 const size_t voxelizationShift = inputBitResolution - outputBitResolution;
175 const size_t approximateVoxelCount = 1U << (outputBitResolution * 2U);
176 voxelizedPointsGeometry.reserve(approximateVoxelCount);
177 voxelIdToPointsId.reserve(approximateVoxelCount);
180 voxelCoordToVoxelIndex.
reserve(approximateVoxelCount);
182 const size_t inputSize = inputPointsGeometry.size();
183 for (
size_t inputPointIndex = 0; inputPointIndex < inputSize; ++inputPointIndex) {
192 size_t voxelIndex = voxelizedPointsGeometry.size();
193 auto [it, inserted] = voxelCoordToVoxelIndex.
try_emplace(voxCoord, voxelIndex);
195 voxelizedPointsGeometry.emplace_back(voxCoord);
196 voxelIdToPointsId.emplace_back();
197 voxelIdToPointsId.back().reserve(16);
200 voxelIdToPointsId[it->second].push_back(inputPointIndex);
Definition robin_hood.h:921
std::pair< iterator, bool > try_emplace(const key_type &key, Args &&... args)
Definition robin_hood.h:1835
void reserve(size_t c)
Definition robin_hood.h:2084
uint16_t typeGeometryInput
Definition utils.hpp:46
Definition utilsPatchGeneration.hpp:106
size_t operator()(const Vector3< T > &vector) const
Definition utilsPatchGeneration.hpp:107
void voxelization(const std::vector< Vector3< typeGeometryInput > > &inputPointsGeometry, std::vector< Vector3< typeGeometryInput > > &voxelizedPointsGeometry, std::vector< std::vector< size_t > > &voxelIdToPointsId, const size_t inputBitResolution, const size_t outputBitResolution)
Definition utilsPatchGeneration.hpp:162
double dotProduct(const std::array< T, 3 > &arr1, const std::array< TT, 3 > &arr2)
Definition utilsPatchGeneration.hpp:99