ConvexHull class

Computes the convex hull of a {@link 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.7

Constructors

ConvexHull(Geometry geometry)
Create a new convex hull construction for the input {@link Geometry}.
ConvexHull.fromPoints(List<Coordinate> pts, GeometryFactory geomFactory)
Create a new convex hull construction for the input {@link Coordinate} array.

Properties

geomFactory GeometryFactory
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
inputPts List<Coordinate>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cleanRing(List<Coordinate> original) List<Coordinate>
@param vertices the vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear) @return the coordinates with unnecessary (collinear) vertices removed
computeOctPts(List<Coordinate> inputPts) List<Coordinate>
computeOctRing(List<Coordinate> inputPts) List<Coordinate>?
getConvexHull() Geometry
Returns a {@link Geometry} that represents the convex hull of the input geometry. The returned geometry contains the minimal number of points needed to represent the convex hull. In particular, no more than two consecutive points will be collinear.
grahamScan(List<Coordinate> c) List<Coordinate>
Uses the Graham Scan algorithm to compute the convex hull vertices.
isBetween(Coordinate c1, Coordinate c2, Coordinate c3) bool
@return whether the three coordinates are collinear and c2 lies between c1 and c3 inclusive
lineOrPolygon(List<Coordinate> coordinates) Geometry
@param vertices the vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear) @return a 2-vertex LineString if the vertices are collinear; otherwise, a Polygon with unnecessary (collinear) vertices removed
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
padArray3(List<Coordinate> pts) List<Coordinate>
preSort(List<Coordinate> pts) List<Coordinate>
reduce(List<Coordinate> inputPts) List<Coordinate>
Uses a heuristic to reduce the number of points scanned to compute the hull. The heuristic is to find a polygon guaranteed to be in (or on) the hull, and eliminate all points inside it. A quadrilateral defined by the extremal points in the four orthogonal directions can be used, but even more inclusive is to use an octilateral defined by the points in the 8 cardinal directions.
toCoordinateArray(List<Coordinate> stack) List<Coordinate>
An alternative to Stack.toArray, which is not present in earlier versions of Java.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

extractCoordinates(Geometry geom) List<Coordinate>