12#ifndef EBGEOMETRY_POINTCLOUDBVH_HPP
13#define EBGEOMETRY_POINTCLOUDBVH_HPP
57 class Meta = std::size_t,
58 size_t K = BVH::DefaultBranchingRatio<T>(),
59 size_t W = PointSoA::DefaultWidth<T>()>
61 :
public BVH::PackedBVH<T, PointAoSoA<T, std::size_t, W>, K, BVH::ValueStorage<PointAoSoA<T, std::size_t, W>>>
216 return m_positions.size();
247 std::vector<Node> nodes;
248 std::vector<PointGroup> primitives;
249 std::vector<std::uint32_t> leafOff;
250 std::vector<std::uint32_t> leafCnt;
251 std::vector<std::uint32_t> order;
263 const std::vector<Vec3T<T>>& a_positions,
264 const std::vector<Meta>& a_metadata);
275 static inline BuildResult
276 buildTree(
const std::vector<Vec3T<T>>& a_positions, std::size_t a_leafSize);
290 query(
const Vec3T<T>& a_query,
293 std::size_t& a_found,
294 std::size_t a_exclude,
295 std::uint32_t a_seedOff,
296 std::uint32_t a_seedCnt)
const noexcept;
305 [[nodiscard]]
inline Hit
306 bruteForceOne(
const Vec3T<T>& a_query, std::size_t a_exclude)
const noexcept;
318 bruteForceK(
const Vec3T<T>& a_query, std::size_t a_k, Hit* a_out, std::size_t a_exclude)
const;
323 static constexpr std::size_t s_none = std::numeric_limits<std::size_t>::max();
328 std::vector<Vec3T<T>> m_positions;
333 std::vector<Meta> m_metadata;
338 std::vector<std::uint32_t> m_leafOff;
343 std::vector<std::uint32_t> m_leafCnt;
349 std::vector<std::uint32_t> m_order;
354#include "EBGeometry_PointCloudBVHImplem.hpp"
Declaration of bounding volume hierarchy (BVH) classes.
Declarations of bounding volume types used in bounding volume hierarchies.
Declaration of a metadata-carrying wrapper around PointSoAT.
Declaration of a true SoA point-position group for SIMD nearest-neighbor evaluation.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Forward declaration of the linearised BVH. Needed so that TreeBVH::pack() and TreeBVH::packWith() can...
Definition EBGeometry_BVH.hpp:1238
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:247
A PackedBVH specialized for point clouds, with a fast build and turnkey queries.
Definition EBGeometry_PointCloudBVH.hpp:62
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.
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()).
PointCloudBVH(const std::vector< Vec3T< T > > &a_positions, const std::vector< Meta > &a_metadata, std::size_t a_targetLeafSize=16 *W)
Build a BVH over a point cloud.
const Vec3T< T > & position(std::size_t a_index) const noexcept
Position of the point with the given cloud index.
Definition EBGeometry_PointCloudBVH.hpp:225
Hit closestPoint(const Vec3T< T > &a_query) const noexcept
Closest cloud point to an arbitrary query point.
PointCloudBVH()=delete
No default construction – a point cloud is required.
Hit closestPointBruteForce(const Vec3T< T > &a_query) const noexcept
Brute-force closest point to an arbitrary query point (O(N) reference for closestPoint()).
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_PointCloudBVH.hpp:214
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::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 nearestNeighbor(std::size_t a_point) const noexcept
Nearest other point to a point already in the cloud (seed-from-own-leaf search).
typename Base::Node Node
Flat node type inherited from Base.
Definition EBGeometry_PointCloudBVH.hpp:77
const Meta & metadata(std::size_t a_index) const noexcept
User metadata of the point with the given cloud index.
Definition EBGeometry_PointCloudBVH.hpp:236
Hit nearestNeighborBruteForce(std::size_t a_point) const noexcept
Brute-force nearest other point to a cloud point (O(N) reference for nearestNeighbor()).
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31
Compact BVH node stored in the flat node array.
Definition EBGeometry_BVH.hpp:1262
One query result: the cloud index of a matched point and its squared distance.
Definition EBGeometry_PointCloudBVH.hpp:94
std::size_t index
Cloud index of the matched point.
Definition EBGeometry_PointCloudBVH.hpp:95
T distanceSquared
Squared distance from the query to it.
Definition EBGeometry_PointCloudBVH.hpp:96