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 distance
information.
|
| 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> localPointsSortedByYCoordinate)
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> localPointsSortedByYCoordinate)
low - the index, inclusive, delimiting the low boundary of the
portion of the list in which to search for the closest point
pair.high - the index, exclusive, delimiting the high boundary of the
portion of the list in which to search for the closest point
pair.localPointsSortedByYCoordinate - the points from the portion of the list delimited by the low
and high parameters, sorted by y coordinate.public Point2D[] execute()
Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.