Avogadro::Core::NeighborPerceiver#
-
class NeighborPerceiver#
This class can be used to find physically neighboring points in linear average time.
<avogadro/core/neighborperceiver.h>
Public Functions
-
NeighborPerceiver(const Array<Vector3> points, float maxDistance)#
Creates a NeighborPerceiver that detects neighbors up to at least some distance.
- Parameters:
points – Positions in 3D space to detect neighbors among.
maxDistance – All neighbors strictly within this distance will be detected. Should be as low as possible for best performance.
-
Array<Index> getNeighborsInclusive(const Vector3 &point) const#
Returns a list of neighboring points. Linear time to number of neighbors. Can include some neighbors up to 2*sqrt(3) times the maximum distance. The list is newly allocated on every call; if performance/fragmentation is a concern, prefer NeighborPerceiver::getNeighborsInclusiveInPlace().
- Parameters:
point – Position to return neighbors of, can be located anywhere.
-
void getNeighborsInclusiveInPlace(Array<Index> &out, const Vector3 &point) const#
Fills an array with all neighboring points. Linear time to number of neighbors. Can include some neighbors up to 2*sqrt(3) times the maximum distance.
- Parameters:
out – Array to output neighbor indices in.
point – Position to return neighbors of, can be located anywhere.
-
NeighborPerceiver(const Array<Vector3> points, float maxDistance)#