EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Functions | Variables
EBGeometry::PointCloud Namespace Reference

Query results and helpers shared by PointCloudBVH and PointCloudHashGrid. More...

Classes

struct  Hit
 One query result: the cloud index of a matched point and its squared distance. More...
 
class  KBest
 The k nearest points seen so far, kept sorted in a caller-supplied buffer. More...
 

Functions

template<class T >
std::size_t closestPointsBruteForce (const Vec3T< T > *a_positions, const uint32_t a_numPoints, const Vec3T< T > &a_query, const std::size_t a_k, Hit< T > *a_out, const uint32_t a_exclude=InvalidIndex) noexcept
 The a_k points of a cloud nearest to a query point, by a full scan.
 
template<class T >
Hit< T > closestPointBruteForce (const Vec3T< T > *a_positions, const uint32_t a_numPoints, const Vec3T< T > &a_query, const uint32_t a_exclude=InvalidIndex) noexcept
 The point of a cloud nearest to a query point, by a full scan.
 

Variables

constexpr uint32_t InvalidIndex = Math::Limits<uint32_t>::max()
 The cloud index of "no point": a miss, or a result slot a query could not fill.
 

Detailed Description

Query results and helpers shared by PointCloudBVH and PointCloudHashGrid.

Both structures answer the same queries with the same Hit type, so code written against one works with the other. A point is identified by its cloud index: its position in the positions array the structure was built from. Per-point user data lives in the caller's own array, indexed by it.

Function Documentation

◆ closestPointBruteForce()

template<class T >
Hit< T > EBGeometry::PointCloud::closestPointBruteForce ( const Vec3T< T > *  a_positions,
const uint32_t  a_numPoints,
const Vec3T< T > &  a_query,
const uint32_t  a_exclude = InvalidIndex 
)
inlinenoexcept

The point of a cloud nearest to a query point, by a full scan.

closestPointsBruteForce() with a_k = 1; a miss if every point is excluded or the cloud is empty.

Template Parameters
TFloating-point precision.
Parameters
[in]a_positionsPoint positions, indexed by cloud index. May be null if a_numPoints is 0.
[in]a_numPointsNumber of points.
[in]a_queryQuery point.
[in]a_excludeCloud index never to report, or InvalidIndex.
Returns
The nearest point and its squared distance.

◆ closestPointsBruteForce()

template<class T >
std::size_t EBGeometry::PointCloud::closestPointsBruteForce ( const Vec3T< T > *  a_positions,
const uint32_t  a_numPoints,
const Vec3T< T > &  a_query,
const std::size_t  a_k,
Hit< T > *  a_out,
const uint32_t  a_exclude = InvalidIndex 
)
inlinenoexcept

The a_k points of a cloud nearest to a query point, by a full scan.

An O(N) reference for checking PointCloudBVH and PointCloudHashGrid, never a hot path. It follows their result contract: the buffer is filled in ascending order of distance, and the count found is returned. For a self-query (the nearest other points to cloud point i), pass that point's position as a_query and i as a_exclude. Callable on the host and on a device.

Template Parameters
TFloating-point precision.
Parameters
[in]a_positionsPoint positions, indexed by cloud index. May be null if a_numPoints is 0.
[in]a_numPointsNumber of points.
[in]a_queryQuery point.
[in]a_kNumber of neighbors wanted. Must be > 0.
[out]a_outBuffer of at least a_k Hits.
[in]a_excludeCloud index never to report, or InvalidIndex.
Returns
The number of neighbors found: min(a_k, number of points not excluded).

Variable Documentation

◆ InvalidIndex

constexpr uint32_t EBGeometry::PointCloud::InvalidIndex = Math::Limits<uint32_t>::max()
inlineconstexpr

The cloud index of "no point": a miss, or a result slot a query could not fill.

A cloud holds fewer points than this (the constructors check it), so it never names a real point.