Package micycle.pgs.commons
Class FarthestPointPair
java.lang.Object
micycle.pgs.commons.FarthestPointPair
The
FarthestPair
data type computes the farthest pair of points in a
set of n points in the plane and provides accessor methods for
getting the farthest pair of points and the distance between them. The
distance between two points is their Euclidean distance.
This implementation computes the convex hull of the set of points and uses the rotating calipers method to find all antipodal point pairs and the farthest pair. It runs in O(n log n) time in the worst case and uses O(N) extra space.
- Author:
- Robert Sedgewick, Kevin Wayne, Adapted by Michael Carleton
-
Constructor Summary
ConstructorsConstructorDescriptionFarthestPointPair
(Collection<processing.core.PVector> points) Computes the farthest pair of points in the specified array of points. -
Method Summary
-
Constructor Details
-
FarthestPointPair
Computes the farthest pair of points in the specified array of points.- Parameters:
points
- an array of points
-
-
Method Details
-
either
public processing.core.PVector either()Returns one of the points in the farthest pair of points.- Returns:
- one of the two points in the farthest pair of points;
null
if no such point (because there are fewer than 2 points)
-
other
public processing.core.PVector other()Returns the other point in the farthest pair of points.- Returns:
- the other point in the farthest pair of points
null
if no such point (because there are fewer than 2 points)
-