com.vividsolutions.jts.algorithm

Class ConvexHull


public class ConvexHull
extends java.lang.Object

Computes the convex hull of a Geometry. The convex hull is the smallest convex Geometry that contains all the points in the input Geometry. Uses the Graham Scan algorithm.
Version:
1.6

Constructor Summary

ConvexHull(Geometry geometry)
Create a new convex hull construction for the input Geometry.

Method Summary

Geometry
getConvexHull()
Returns a Geometry that represents the convex hull of the input geometry.
protected Coordinate[]
toCoordinateArray(Stack stack)
An alternative to Stack.toArray, which is not present in earlier versions of Java.

Constructor Details

ConvexHull

public ConvexHull(Geometry geometry)
Create a new convex hull construction for the input Geometry.

Method Details

getConvexHull

public Geometry getConvexHull()
Returns a Geometry that represents the convex hull of the input geometry. The geometry will contain the minimal number of points needed to represent the convex hull. In particular, no more than two consecutive points will be collinear.
Returns:
if the convex hull contains 3 or more points, a Polygon; 2 points, a LineString; 1 point, a Point; 0 points, an empty GeometryCollection.

toCoordinateArray

protected Coordinate[] toCoordinateArray(Stack stack)
An alternative to Stack.toArray, which is not present in earlier versions of Java.