public class ConcaveHullOfPolygons extends Object
The concave hull is constructed by removing the longest outer edges of the constrained Delaunay Triangulation of the space between the polygons, until the target criterion parameter is reached.
The target criteria are:
setHolesAllowed(boolean)
.
The hull can be specified as being "tight", via setTight(boolean)
.
This causes the result to follow the outer boundaries of the input polygons.
Instead of the complete hull, the "fill area" between the input polygons
can be computed using getFill()
.
The input polygons must form a valid MultiPolygon
(i.e. they must be non-overlapping and non-edge-adjacent).
If needed, a set of possibly-overlapping Polygons
can be converted to a valid MultiPolygon
by using Geometry.union()
;
Constructor and Description |
---|
ConcaveHullOfPolygons(Geometry polygons)
Creates a new instance for a given geometry.
|
Modifier and Type | Method and Description |
---|---|
static Geometry |
concaveFillByLength(Geometry polygons,
double maxLength)
Computes a concave fill area between a set of polygons,
using the target criterion of maximum edge length.
|
static Geometry |
concaveFillByLengthRatio(Geometry polygons,
double lengthRatio)
Computes a concave fill area between a set of polygons,
using the target criterion of maximum edge length ratio.
|
static Geometry |
concaveHullByLength(Geometry polygons,
double maxLength)
Computes a concave hull of set of polygons
using the target criterion of maximum edge length.
|
static Geometry |
concaveHullByLength(Geometry polygons,
double maxLength,
boolean isTight,
boolean isHolesAllowed)
Computes a concave hull of set of polygons
using the target criterion of maximum edge length,
and allowing control over whether the hull boundary is tight
and can contain holes.
|
static Geometry |
concaveHullByLengthRatio(Geometry polygons,
double lengthRatio)
Computes a concave hull of set of polygons
using the target criterion of maximum edge length ratio.
|
static Geometry |
concaveHullByLengthRatio(Geometry polygons,
double lengthRatio,
boolean isTight,
boolean isHolesAllowed)
Computes a concave hull of set of polygons
using the target criterion of maximum edge length ratio,
and allowing control over whether the hull boundary is tight
and can contain holes.
|
Geometry |
getFill()
Gets the concave fill, which is the area between the input polygons,
subject to the concaveness control parameter.
|
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.
|
void |
setTight(boolean isTight)
Sets whether the boundary of the hull polygon is kept
tight to the outer edges of the input polygons.
|
public ConcaveHullOfPolygons(Geometry polygons)
geom
- the input geometrypublic static Geometry concaveHullByLength(Geometry polygons, double maxLength)
polygons
- the input polygonsmaxLength
- the target maximum edge lengthpublic static Geometry concaveHullByLength(Geometry polygons, double maxLength, boolean isTight, boolean isHolesAllowed)
polygons
- the input polygonsmaxLength
- the target maximum edge lengthisTight
- true if the hull should be tight to the outside of the polygonsisHolesAllowed
- true if holes are allowed in the hull polygonpublic static Geometry concaveHullByLengthRatio(Geometry polygons, double lengthRatio)
polygons
- the input polygonslengthRatio
- the target maximum edge length ratiopublic static Geometry concaveHullByLengthRatio(Geometry polygons, double lengthRatio, boolean isTight, boolean isHolesAllowed)
polygons
- the input polygonslengthRatio
- the target maximum edge length ratioisTight
- true if the hull should be tight to the outside of the polygonsisHolesAllowed
- true if holes are allowed in the hull polygonpublic static Geometry concaveFillByLength(Geometry polygons, double maxLength)
polygons
- the input polygonsmaxLength
- the target maximum edge lengthpublic static Geometry concaveFillByLengthRatio(Geometry polygons, double lengthRatio)
polygons
- the input polygonslengthRatio
- the target maximum edge length ratiopublic void setMaximumEdgeLength(double edgeLength)
The edge length ratio provides a scale-free parameter which is intended to produce similar concave results for a variety of inputs.
edgeLength
- a non-negative lengthpublic 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 void setTight(boolean isTight)
isTight
- true if the boundary is kept tightpublic Geometry getHull()
public Geometry getFill()
Copyright © 2022. All rights reserved.