public class ConcaveHull extends Object
The concave hull is constructed by removing the longest outer edges of the Delaunay Triangulation of the points, until the target criterion parameter is reached.
The target criteria are:
uniformGridEdgeLength(Geometry)
value.
The computed hull is always a single connected Polygon
(unless it is degenerate, in which case it will be a Point
or a LineString
).
This constraint may cause the concave hull to fail to meet the target criterion.
Optionally the concave hull can be allowed to contain holes. Note that when using the area-based criterion this may result in substantially slower computation.
Constructor and Description |
---|
ConcaveHull(Geometry geom)
Creates a new instance for a given geometry.
|
Modifier and Type | Method and Description |
---|---|
static Geometry |
concaveHullByLength(Geometry geom,
double maxLength)
Computes a concave hull of the vertices in a geometry
using the target criterion of maximum edge length.
|
static Geometry |
concaveHullByLength(Geometry geom,
double maxLength,
boolean isHolesAllowed)
Computes a concave hull of the vertices in a geometry
using the target criterion of maximum edge length,
and optionally allowing holes.
|
static Geometry |
concaveHullByLengthRatio(Geometry geom,
double lengthRatio)
Computes a concave hull of the vertices in a geometry
using the target criterion of maximum edge length ratio.
|
static Geometry |
concaveHullByLengthRatio(Geometry geom,
double lengthRatio,
boolean isHolesAllowed)
Computes a concave hull of the vertices in a geometry
using the target criterion of maximum edge length factor,
and optionally allowing holes.
|
Geometry |
getHull()
Gets the computed concave hull.
|
void |
setHolesAllowed(boolean isHolesAllowed)
Sets whether holes are allowed in the concave hull polygon.
|
void |
setMaximumEdgeLength(double edgeLength)
Sets the target maximum edge length for the concave hull.
|
void |
setMaximumEdgeLengthRatio(double edgeLengthRatio)
Sets the target maximum edge length ratio for the concave hull.
|
static double |
uniformGridEdgeLength(Geometry geom)
Computes the approximate edge length of
a uniform square grid having the same number of
points as a geometry and the same area as its convex hull.
|
public ConcaveHull(Geometry geom)
geom
- the input geometrypublic static double uniformGridEdgeLength(Geometry geom)
geom
- a geometrypublic static Geometry concaveHullByLength(Geometry geom, double maxLength)
geom
- the input geometrymaxLength
- the target maximum edge lengthpublic static Geometry concaveHullByLength(Geometry geom, double maxLength, boolean isHolesAllowed)
geom
- the input geometrymaxLength
- the target maximum edge lengthisHolesAllowed
- whether holes are allowed in the resultpublic static Geometry concaveHullByLengthRatio(Geometry geom, double lengthRatio)
geom
- the input geometrylengthRatio
- the target edge length factorpublic static Geometry concaveHullByLengthRatio(Geometry geom, double lengthRatio, boolean isHolesAllowed)
geom
- the input geometrymaxLength
- the target maximum edge lengthisHolesAllowed
- whether holes are allowed in the resultpublic void setMaximumEdgeLength(double edgeLength)
uniformGridEdgeLength(Geometry)
value may be used as
the basis for estimating an appropriate target maximum edge length.edgeLength
- a non-negative lengthuniformGridEdgeLength(Geometry)
public void setMaximumEdgeLengthRatio(double edgeLengthRatio)
edgeLengthRatio
- a length factor value between 0 and 1public void setHolesAllowed(boolean isHolesAllowed)
isHolesAllowed
- true if holes are allowed in the resultpublic Geometry getHull()
Copyright © 2022. All rights reserved.