|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
The k nearest points seen so far, kept sorted in a caller-supplied buffer. More...
#include <EBGeometry_PointCloud.hpp>
Public Member Functions | |
| KBest (Hit< T > *a_out, const std::size_t a_k, const uint32_t a_exclude=InvalidIndex) noexcept | |
| Start an empty set. | |
| void | insert (const T a_distanceSquared, const uint32_t a_index) noexcept |
| Offer one candidate. | |
| T | bound () const noexcept |
| The squared distance a candidate must beat to be inserted. | |
| std::size_t | found () const noexcept |
| Number of candidates held, at most k. | |
The k nearest points seen so far, kept sorted in a caller-supplied buffer.
The search structures feed every candidate point to insert(), and prune with bound(). The buffer holds the found() best candidates in ascending order of distance; ties keep the candidate inserted first. A candidate is inserted at most once per query by every caller, so no de-duplication is done. Callable on the host and on a device, and allocates nothing.
| T | Floating-point precision. |
|
inlinenoexcept |
Start an empty set.
| [out] | a_out | Buffer of at least a_k Hits. Its first found() entries hold the result. |
| [in] | a_k | Number of neighbors wanted. Must be > 0. |
| [in] | a_exclude | Cloud index never to report (a self-query's own point), or InvalidIndex. |
|
inlinenoexcept |
The squared distance a candidate must beat to be inserted.
Math::Limits<T>::max() until k candidates are held, then the k-th smallest distance. A search may skip any region at least this far from the query.
|
inlinenoexcept |
Number of candidates held, at most k.
|
inlinenoexcept |
Offer one candidate.
Rejected if it is the excluded point or no closer than bound(); otherwise inserted in order, dropping the farthest candidate once k are held.
| [in] | a_distanceSquared | Squared distance from the query to the candidate. |
| [in] | a_index | Cloud index of the candidate. |