public class ClosestPointPair extends Object
The algorithm consists of constructing an ordered list of points, then recursively dividing the list into a left and right sublist towards finding the closest point pairs for each sublist. The two sub-results are merged by selecting the optimal among them and all closer point pairs that cross the boundary of separation. Happily, only a linear amount of work is required to find all closer point pairs that cross the boundary, giving a total runtime of O(n*log(n)) for the algorithm.
Constructor and Description |
---|
ClosestPointPair(Collection<processing.core.PVector> points)
Construct an instance of the algorithm for the specified point Collection.
|
Modifier and Type | Method and Description |
---|---|
List<processing.core.PVector> |
execute()
Execute the algorithm.
|
public ClosestPointPair(Collection<processing.core.PVector> points)
points
- the Collection of points through which to search for the
closest pair.public List<processing.core.PVector> execute()
Copyright © 2023. All rights reserved.