12#ifndef EBGEOMETRY_POINTCLOUDHASHGRID_HPP
13#define EBGEOMETRY_POINTCLOUDHASHGRID_HPP
53template <
class T,
class Meta = std::
size_t>
186 return m_positions.size();
220 cellCoord(T
a_x, T
a_lo,
int a_n)
const noexcept;
275 static constexpr std::size_t s_none = std::numeric_limits<std::size_t>::max();
280 std::vector<Vec3T<T>> m_positions;
285 std::vector<Meta> m_metadata;
305 int m_nx = 1, m_ny = 1, m_nz = 1;
310 std::vector<std::uint32_t> m_cellStart;
315 std::vector<std::uint32_t> m_cellPoints;
320#include "EBGeometry_PointCloudHashGridImplem.hpp"
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
A uniform spatial grid specialized for point clouds, with a fast build and turnkey queries.
Definition EBGeometry_PointCloudHashGrid.hpp:55
PointCloudHashGrid()=delete
No default construction – a point cloud is required.
std::vector< Hit > allNearestNeighbors(std::size_t a_k=1) const
For every point, its a_k nearest other points (the k-nearest-neighbor graph).
Hit nearestNeighborBruteForce(std::size_t a_point) const noexcept
Brute-force nearest other point to a cloud point (O(N) reference for nearestNeighbor()).
Hit closestPoint(const Vec3T< T > &a_query) const noexcept
Closest cloud point to an arbitrary query point.
std::size_t closestPointsBruteForce(const Vec3T< T > &a_query, std::size_t a_k, Hit *a_out) const
Brute-force a_k closest points to an arbitrary query point (O(N) reference for closestPoints()).
Hit nearestNeighbor(std::size_t a_point) const noexcept
Nearest other point to a point already in the cloud.
std::size_t nearestNeighborsBruteForce(std::size_t a_point, std::size_t a_k, Hit *a_out) const
Brute-force a_k nearest other points to a cloud point (O(N) reference for nearestNeighbors()).
std::size_t closestPoints(const Vec3T< T > &a_query, std::size_t a_k, Hit *a_out) const noexcept
The a_k closest cloud points to an arbitrary query point, nearest first.
const Meta & metadata(std::size_t a_index) const noexcept
User metadata of the point with the given cloud index.
Definition EBGeometry_PointCloudHashGrid.hpp:206
std::size_t nearestNeighbors(std::size_t a_point, std::size_t a_k, Hit *a_out) const noexcept
The a_k nearest other points to a point already in the cloud, nearest first.
std::size_t numPoints() const noexcept
Number of points in the cloud.
Definition EBGeometry_PointCloudHashGrid.hpp:184
const Vec3T< T > & position(std::size_t a_index) const noexcept
Position of the point with the given cloud index.
Definition EBGeometry_PointCloudHashGrid.hpp:195
PointCloudHashGrid(const std::vector< Vec3T< T > > &a_positions, const std::vector< Meta > &a_metadata, T a_targetPerCell=T(1))
Build a uniform grid over a point cloud.
Hit closestPointBruteForce(const Vec3T< T > &a_query) const noexcept
Brute-force closest point to an arbitrary query point (O(N) reference for closestPoint()).
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31
One query result: the cloud index of a matched point and its squared distance.
Definition EBGeometry_PointCloudHashGrid.hpp:67
T distanceSquared
Squared distance from the query to it.
Definition EBGeometry_PointCloudHashGrid.hpp:69
std::size_t index
Cloud index of the matched point.
Definition EBGeometry_PointCloudHashGrid.hpp:68