public class ClosestPointPairAlgorithm extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ClosestPointPairAlgorithm.PairStructure
Convenience data structure to hold a pair of points along with their
distance from one another.
|
| Constructor and Description |
|---|
ClosestPointPairAlgorithm(Collection<Point2D> points)
Construct an instance of the algorithm for the specified point Collection.
|
| Modifier and Type | Method and Description |
|---|---|
protected ClosestPointPairAlgorithm.PairStructure |
closestPair(int low,
int high,
List<Point2D> localPointsOrderedByYCoordinate)
Internal helper method which implements the closest point pair algorithm.
|
Point2D[] |
execute()
Execute the algorithm.
|
public ClosestPointPairAlgorithm(Collection<Point2D> points)
points - the Collection of points through which to search for the closest
pair.protected ClosestPointPairAlgorithm.PairStructure closestPair(int low, int high, List<Point2D> localPointsOrderedByYCoordinate)
low - the starting index, inclusive, of the sublist in which to search
for the closest point pair.high - the ending index, exclusive, of the sublist in which to search for
the closest point pair.localPointsOrderedByYCoordinate - the points from the target sublist, ordered by y coordinate.public Point2D[] execute()
Copyright © 2017. All rights reserved.