12#ifndef EBGEOMETRY_POINTCLOUDBVH_HPP
13#define EBGEOMETRY_POINTCLOUDBVH_HPP
111template <class T, size_t K = BVH::DefaultBranchingRatio<T>(),
size_t W = PointSoA::DefaultWidth<T>()>
185 template <
class Source>
189 const Source& a_source,
190 uint32_t a_numPoints,
191 std::size_t a_targetLeafSize = 16 * W,
192 uint32_t a_maxPoints = 0);
206 const std::vector<
Vec3T<T>>& a_positions,
207 std::size_t a_targetLeafSize = 16 * W,
208 uint32_t a_maxPoints = 0);
223 template <
class Source>
226 rebuild(
const Source& a_source, uint32_t a_numPoints);
290 inline std::vector<Hit>
301 return m_items.
size();
315 return m_items.
at(this->
base(), a_index);
402 query(const
Vec3T<T>& a_query,
406 std::uint32_t a_seedOff,
407 std::uint32_t a_seedCnt) const noexcept;
419#include "EBGeometry_PointCloudBVHImplem.hpp"
Declarations of bounding volume types used in bounding volume hierarchies.
The linear BVH build shared by PointCloudBVH and SphereCloudBVH, over a cloud of points or spheres.
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:269
Scalar helpers and numeric limits that compile for both host and device.
Placement-independent POD array views for the GPU memory foundation.
The flattened, device-callable bounding volume hierarchy: PackedBVH, its node layout,...
Declaration of a PointSoAT group that carries point ids.
Internal helpers shared by PointCloudBVH and PointCloudHashGrid, and by their builds.
Query results and helpers shared by the point-cloud search structures.
Declaration of a true SoA point-position group for SIMD nearest-neighbor evaluation.
Growable bump arena for the GPU memory foundation.
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Forward declaration of the linearised BVH, defined below.
Definition EBGeometry_PackedBVH.hpp:369
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:37
A BVH over a point cloud, with a fast build and turnkey queries.
Definition EBGeometry_PointCloudBVH.hpp:113
PointCloudBVH(Pool &a_pool, const std::vector< Vec3T< T > > &a_positions, std::size_t a_targetLeafSize=16 *W)
Build a BVH over a point cloud on the host: shorthand for build(a_pool, a_positions,...
BVH::PackedBVH< T, PointGroup, K > Packed
The packed BVH this class holds over its point groups.
Definition EBGeometry_PointCloudBVH.hpp:123
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.
static PointCloudBVH build(Pool &a_pool, const Source &a_source, uint32_t a_numPoints, std::size_t a_targetLeafSize=16 *W, uint32_t a_maxPoints=0)
Build a BVH over a point cloud, where the pool's memory is.
Hit nearestNeighbor(uint32_t a_point) const noexcept
Nearest other point to a point already in the cloud (seed-from-own-leaf search).
static PointCloudBVH build(Pool &a_pool, const std::vector< Vec3T< T > > &a_positions, std::size_t a_targetLeafSize=16 *W, uint32_t a_maxPoints=0)
Build a BVH over points on the host, where the pool's memory is; see the build() above.
uint32_t maxPoints() const noexcept
The most points rebuild() can take.
Definition EBGeometry_PointCloudBVH.hpp:234
Hit closestPoint(const Vec3T< T > &a_query) const noexcept
Closest cloud point to an arbitrary query point.
const Vec3T< T > & position(uint32_t a_index) const noexcept
Position of the point with the given cloud index.
Definition EBGeometry_PointCloudBVH.hpp:311
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).
typename Packed::Node Node
Flat node type of the held BVH.
Definition EBGeometry_PointCloudBVH.hpp:128
Packed getBVH() const noexcept
The held packed BVH over the point groups.
Definition EBGeometry_PointCloudBVH.hpp:326
void rebuild(const Source &a_source, uint32_t a_numPoints)
Build the BVH again, in the arrays build() reserved, from new positions.
PointCloudBVH deepCopy(Pool &a_dstPool) const
Duplicate this object's storage into a_dstPool.
void * base() noexcept
The base address this object's arrays are offsets from; see PoolHandle::base().
Definition EBGeometry_Pool.hpp:639
PointCloudBVH rebasedView(const Pool &a_pool) const noexcept
Produce a copy of this object that resolves against a_pool.
std::size_t nearestNeighbors(uint32_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:299
PointCloud::Hit< T > Hit
One query result: the cloud index of a matched point and its squared distance.
Definition EBGeometry_PointCloudBVH.hpp:140
The state and build of a linear BVH over a cloud of primitives (points or spheres),...
Definition EBGeometry_CloudBVH.hpp:192
PODVector< std::uint32_t > m_order
Cloud indices in leaf (build) order; the spatially coherent batch-query order.
Definition EBGeometry_CloudBVH.hpp:457
std::uint32_t m_maxItems
The most primitives a rebuild can take, 0 for none.
Definition EBGeometry_CloudBVH.hpp:467
PODVector< Item > m_items
The primitives, indexed by cloud index.
Definition EBGeometry_CloudBVH.hpp:442
PODVector< std::uint32_t > m_leafOff
Per-primitive own-leaf group offset (for seeding).
Definition EBGeometry_CloudBVH.hpp:447
PODVector< std::uint32_t > m_leafCnt
Per-primitive own-leaf group count (for seeding).
Definition EBGeometry_CloudBVH.hpp:452
Packed::Layout m_bvhLayout
The packed BVH over the groups, as a layout: it shares this object's location.
Definition EBGeometry_CloudBVH.hpp:437
PoolLocation location() const noexcept
Where this handle's arrays live.
Definition EBGeometry_Pool.hpp:571
void * base() noexcept
The base address this handle's offsets resolve against; see PoolLocation::base().
Definition EBGeometry_Pool.hpp:639
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:205
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
Compact BVH node stored in the flat node array.
Definition EBGeometry_PackedBVH.hpp:393
T & at(void *a_base, uint32_t a_i) const noexcept
Mutable element access against a_base.
Definition EBGeometry_PODVector.hpp:220
uint32_t size() const noexcept
Number of constructed elements.
Definition EBGeometry_PODVector.hpp:248
A PointSoAT<T, W> group that also carries each point's cloud index.
Definition EBGeometry_PointAoSoA.hpp:44
One query result: the cloud index of a matched point and its squared distance.
Definition EBGeometry_PointCloud.hpp:53