A PackedBVH specialized for point clouds, with a fast build and turnkey queries.
More...
|
|
| PointCloudBVH ()=delete |
| | No default construction – a point cloud is required.
|
| |
| | 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.
|
| |
| Hit | closestPoint (const Vec3T< T > &a_query) const noexcept |
| | Closest cloud point to an arbitrary query point.
|
| |
| 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.
|
| |
| Hit | nearestNeighbor (std::size_t a_point) const noexcept |
| | Nearest other point to a point already in the cloud (seed-from-own-leaf search).
|
| |
| 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::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 | 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 | 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 | nearestNeighborBruteForce (std::size_t a_point) const noexcept |
| | Brute-force nearest other point to a cloud point (O(N) reference for nearestNeighbor()).
|
| |
| 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 | numPoints () const noexcept |
| | Number of points in the cloud.
|
| |
| const Vec3T< T > & | position (std::size_t a_index) const noexcept |
| | Position of the point with the given cloud index.
|
| |
| const Meta & | metadata (std::size_t a_index) const noexcept |
| | User metadata of the point with the given cloud index.
|
| |
|
| PackedBVH ()=delete |
| | Deleted default constructor. Use TreeBVH::pack() or TreeBVH::packWith() to construct.
|
| |
| | PackedBVH (const TreeBVH< T, P, BV, K > &a_tree) |
| | Construct by packing a TreeBVH (identity primitive type).
|
| |
| template<class Q , class Converter > |
| | PackedBVH (const TreeBVH< T, Q, BV, K > &a_tree, Converter &&a_converter) |
| | Construct by packing a TreeBVH with primitive-type conversion.
|
| |
| template<class S = SFC::Morton> |
| | PackedBVH (std::vector< std::pair< P, BV > > a_primsAndBVs, size_t a_targetLeafSize, S a_sfc=S{}) |
| | Construct directly from a flat primitive list, without ever building a TreeBVH.
|
| |
| | PackedBVH (std::vector< std::pair< P, BV > > a_primsAndBVs, const BVH::Partitioner< P, BV, K > &a_partitioner=BVCentroidPartitioner< T, P, BV, K >, const BVH::LeafPredicate< T, P, BV, K > &a_stopCrit=DefaultLeafPredicate< T, P, BV, K >) |
| | Construct directly from a flat primitive list via top-down (optionally SAH) recursive partitioning, without ever building a TreeBVH.
|
| |
| | PackedBVH (std::vector< std::pair< P, BV > > a_primsAndBVs, BVH::ClusterSpec a_spec) |
| | Construct directly via ClusterSAH: cluster primitives, then SAH over the clusters.
|
| |
| | ~PackedBVH ()=default |
| | Destructor.
|
| |
| | PackedBVH (const PackedBVH &a_other)=default |
| | Copy constructor.
|
| |
| PackedBVH & | operator= (const PackedBVH &a_other)=default |
| | Copy assignment operator.
|
| |
| | PackedBVH (PackedBVH &&a_other) noexcept=default |
| | Move constructor.
|
| |
| PackedBVH & | operator= (PackedBVH &&a_other) noexcept=default |
| | Move assignment operator.
|
| |
| const std::vector< StorageType > & | getPrimitives () const noexcept |
| | Get the global primitive list (in leaf-traversal order).
|
| |
| const BV & | getBoundingVolume () const noexcept |
| | Get the bounding volume of the root node.
|
| |
| BV | computeBoundingVolume () const noexcept |
| | Compute and return the bounding volume of this BVH.
|
| |
| template<class NodeKey > |
| void | traverse (const BVH::PackedLeafEvaluator< P, StoragePolicy > &a_leafEvaluator, const BVH::PrunePredicate< Node, NodeKey > &a_prunePredicate, const BVH::PackedChildOrderer< NodeKey, K > &a_childOrderer, const BVH::NodeKeyFactory< Node, NodeKey > &a_nodeKeyFactory) const noexcept |
| | Recursion-free BVH traversal using a vector-backed LIFO stack (depth-first order).
|
| |
| template<class State , class LeafEvaluator , class PruneDistSquared > |
| void | pruneTraverse (const Vec3T< T > &a_point, State &a_state, LeafEvaluator &&a_evalLeaf, PruneDistSquared &&a_pruneDist2) const noexcept |
| | Generic SIMD-accelerated, distance-pruned traversal.
|
| |
template<
class T,
class Meta = std::size_t,
size_t K = BVH::DefaultBranchingRatio<T>(),
size_t W = PointSoA::DefaultWidth<T>()>
class EBGeometry::PointCloudBVH< T, Meta, K, W >
A PackedBVH specialized for point clouds, with a fast build and turnkey queries.
Unlike the general PackedBVH constructors (which take a list of pre-made primitives and partition it via SAH/Midpoint/SFC), PointCloudBVH is built directly from a raw point cloud – positions plus a parallel array of user metadata. It uses an index-based, copy-free top-down build (partition an index permutation in place by longest-axis midpoint, pack leaves into PointAoSoA<T, size_t, W> groups inline), which is far cheaper than the general path and produces a tree just as tight for near-uniform clouds.
Every leaf carries the point's cloud index (its position in the input arrays) as metadata, so queries return that index; the user's own metadata is stored alongside and reachable via metadata(). The class hides all of pruneTraverse()/the SoA leaf kernel/the seed-from-own-leaf optimization behind a few high-level query methods.
- Note
- Queries come in two flavours. External queries (closestPoint / closestPoints) take an arbitrary point and traverse top-down. Self queries (nearestNeighbor / nearestNeighbors), and the batch allNearestNeighbors(), take a point already in the cloud and additionally seed the search bound from the leaf that point lives in (skipping that leaf during traversal) – a strictly cheaper search that an external point cannot use.
- Template Parameters
-
| T | Floating-point precision. |
| Meta | User metadata type stored per point and returned via metadata(). Defaults to the cloud index itself (std::size_t). |
| K | BVH branching factor. Defaults to the SIMD-optimal value for T. |
| W | Points per SoA leaf lane group. Defaults to the SIMD-optimal width for T. |