public class NearestNeighborPointCollector extends Object
This class is intended to support testing and verification. It has no direct relationship with any of the graph-based structures produced by the Tinfour library.
The design of this class is optimized for repeated searches of very large vertex sets. While the up front processing is not trivial, the time cost is compensated for by more efficient processing across multiple searches.
Constructor and Description |
---|
NearestNeighborPointCollector(List<Vertex> vList,
boolean mergeDuplicates)
Construct a collector based on the specified list of vertices and
bounds.
|
Modifier and Type | Method and Description |
---|---|
int |
getNearestNeighbors(double x,
double y,
int k,
double[] d,
Vertex[] v)
Get the K nearest neighbors from the collection.
|
List<Vertex> |
getVertices()
Gets a list of the vertices currently stored in the collection.
|
void |
setResolutionRule(VertexMergerGroup.ResolutionRule rule)
Sets the rule for resolving coincident vertices; recalculates
value for vertices in the collection, if necessary
|
public NearestNeighborPointCollector(List<Vertex> vList, boolean mergeDuplicates)
vList
- a list of valid verticesmergeDuplicates
- indicates whether duplicates should be merged.public void setResolutionRule(VertexMergerGroup.ResolutionRule rule)
rule
- a valid member of the enumerationpublic int getNearestNeighbors(double x, double y, int k, double[] d, Vertex[] v)
x
- the x coordinate of the search positiony
- the y coordinate of the search positionk
- the target number of vertices to be collectedd
- storage for the distances to the vertices to be collected
(must be dimensioned at least to size k, but can be larger)v
- storage for the vertices to be collected
(must be dimensioned at least to size k, but can be larger)Copyright © 2021. All rights reserved.