Package org.ddogleg.nn.alg
Class ExhaustiveNeighbor<P>
java.lang.Object
org.ddogleg.nn.alg.ExhaustiveNeighbor<P>
Exhaustively finds the nearest-neighbor to a n-dimensional point by considering every possibility.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
findClosest
(P p, double maxDistance) Finds the index of the point which has the smallest Euclidean distance to 'p' and is<
maxDistance away.void
findClosestN
(P p, double maxDistance, int numNeighbors, DogArray_I32 outputIndex, DogArray_F64 outputDistance) Finds the index of the point which has the smallest Euclidean distance to 'p' and is<
maxDistance away.double
void
The input list which the nearest-neighbor is to be found inside of
-
Constructor Details
-
ExhaustiveNeighbor
-
-
Method Details
-
setPoints
The input list which the nearest-neighbor is to be found inside of- Parameters:
points
- List od points
-
findClosest
Finds the index of the point which has the smallest Euclidean distance to 'p' and is<
maxDistance away.- Parameters:
p
- A point.maxDistance
- The maximum distance (Euclidean squared) the neighbor can be.- Returns:
- Index of the closest point.
-
findClosestN
public void findClosestN(P p, double maxDistance, int numNeighbors, DogArray_I32 outputIndex, DogArray_F64 outputDistance) Finds the index of the point which has the smallest Euclidean distance to 'p' and is<
maxDistance away.- Parameters:
p
- A point.maxDistance
- The maximum distance (Euclidean squared) the neighbor can be.numNeighbors
- the requested number of nearest neighbors it should search foroutputIndex
- Storage for the index of the closest elementsoutputDistance
- Storage for the distance of the closest elements
-
getBestDistance
public double getBestDistance()
-