public class FarthestPointPair extends Object
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.
Constructor and Description |
---|
FarthestPointPair(Collection<processing.core.PVector> points)
Computes the farthest pair of points in the specified array of points.
|
Modifier and Type | Method and Description |
---|---|
processing.core.PVector |
either()
Returns one of the points in the farthest pair of points.
|
processing.core.PVector |
other()
Returns the other point in the farthest pair of points.
|
public FarthestPointPair(Collection<processing.core.PVector> points)
points
- an array of pointspublic processing.core.PVector either()
null
if
no such point (because there are fewer than 2 points)public processing.core.PVector other()
null
if no
such point (because there are fewer than 2 points)Copyright © 2023. All rights reserved.