public class GrahamScan extends Object
GrahamScandata type provides methods for computing the convex hull of a set of n points in the plane.
The implementation uses the Graham-Scan convex hull algorithm. It runs in O(n log n) time in the worst case and uses O(n) extra memory.
For additional documentation, see Section 9.9 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
|Constructor and Description|
Computes the convex hull of the specified array of points.
|Modifier and Type||Method and Description|
Returns the extreme points on the convex hull in counterclockwise order.
Unit tests the
public GrahamScan(Point2D points)
public static void main(String args)
GrahamScandata type. Reads in an integer
npoints (specified by their x- and y-coordinates) from standard input; computes their convex hull; and prints out the points on the convex hull to standard output.
args- the command-line arguments