This class can be used to find physically neighboring points in linear average time.
More...
#include <neighborperceiver.h>
|
|
float | m_maxDistance |
|
double | m_binSize |
| | Edge length of the cubic bins. Always equal to m_maxDistance.
|
|
std::unordered_map< BinKey, std::vector< Index >, BinKeyHash > | m_bins |
| | Only occupied bins are stored (sparse), in insertion order per bin.
|
| Vector3 | m_anchor = Vector3::Zero() |
|
Vector3 | m_minPos = Vector3::Zero() |
|
Vector3 | m_maxPos = Vector3::Zero() |
<avogadro/core/neighborperceiver.h>
◆ NeighborPerceiver()
| 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. |
The bin size always equals maxDistance. Only occupied bins are stored, so memory is proportional to the number of points however widely they are spread. Points with non-finite coordinates are ignored: they are never returned as neighbors, and do not affect the other points.
◆ getNeighborsInclusive()
| 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 bin size, which always equals the maximum distance. A non-finite query point has no neighbors. 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. |
◆ getNeighborsInclusiveInPlace()
| 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 bin size, which always equals the maximum distance. A non-finite query point has no neighbors.
- Parameters
-
| out | Array to output neighbor indices in. |
| point | Position to return neighbors of, can be located anywhere. |
◆ m_anchor
| Vector3 m_anchor = Vector3::Zero() |
|
protected |
Origin of the bin grid: the bounding box minimum of the finite points, or the origin if the extent is too large for a minimum-anchored grid.
The documentation for this class was generated from the following file: