GEOS 3.11.1
|
#include <ConcaveHull.h>
Public Member Functions | |
ConcaveHull (const Geometry *geom) | |
void | setMaximumEdgeLength (double edgeLength) |
void | setMaximumEdgeLengthRatio (double edgeLengthRatio) |
void | setHolesAllowed (bool holesAllowed) |
std::unique_ptr< Geometry > | getHull () |
Static Public Member Functions | |
static double | uniformEdgeLength (const Geometry *geom) |
static std::unique_ptr< Geometry > | concaveHullByLength (const Geometry *geom, double maxLength) |
static std::unique_ptr< Geometry > | concaveHullByLength (const Geometry *geom, double maxLength, bool isHolesAllowed) |
static std::unique_ptr< Geometry > | concaveHullByLengthRatio (const Geometry *geom, double lengthRatio) |
static std::unique_ptr< Geometry > | concaveHullByLengthRatio (const Geometry *geom, double lengthRatio, bool isHolesAllowed) |
Constructs a concave hull of a set of points. The hull is constructed by eroding the Delaunay Triangulation of the points until specified target criteria are reached. The target criteria are:
The preferred criterium is the Maximum Edge Length Ratio, since it is scale-free and local (so that no assumption needs to be made about the total amount of concavity present.
Other length criteria can be used by setting the Maximum Edge Length. For example, use a length relative to the longest edge length in the Minimum Spanning Tree of the point set. Or, use a length derived from the uniformGridEdgeLength() value.
The computed hull is always a single connected geom::Polygon (unless it is degenerate, in which case it will be a geom::Point or a geom::LineString). This constraint may cause the concave hull to fail to meet the target criteria.
Optionally the concave hull can be allowed to contain holes. Note that this may be substantially slower than not permitting holes, and it can produce results of lower quality.
|
static |
Computes the concave hull of the vertices in a geometry using the target criteria of maximum edge length.
geom | the input geometry |
maxLength | the target maximum edge length |
|
static |
Computes the concave hull of the vertices in a geometry using the target criteria of maximum edge length ratio. The edge length ratio is a fraction of the length difference between the longest and shortest edges in the Delaunay Triangulation of the input points.
geom | the input geometry |
lengthRatio | the target edge length factor |
|
static |
Computes the concave hull of the vertices in a geometry using the target criterion of maximum edge length factor, and optionally allowing holes. The edge length factor is a fraction of the length difference between the longest and shortest edges in the Delaunay Triangulation of the input points.
geom | the input geometry |
lengthRatio | the target maximum edge length |
isHolesAllowed | whether holes are allowed in the result |
std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHull::getHull | ( | ) |
Gets the computed concave hull.
void geos::algorithm::hull::ConcaveHull::setHolesAllowed | ( | bool | holesAllowed | ) |
Sets whether holes are allowed in the concave hull polygon.
holesAllowed | true if holes are allowed in the result |
void geos::algorithm::hull::ConcaveHull::setMaximumEdgeLength | ( | double | edgeLength | ) |
Sets the target maximum edge length for the concave hull. The length value must be zero or greater.
The uniformGridEdgeLength value may be used as the basis for estimating an appropriate target maximum edge length.
edgeLength | a non-negative length |
void geos::algorithm::hull::ConcaveHull::setMaximumEdgeLengthRatio | ( | double | edgeLengthRatio | ) |
Sets the target maximum edge length ratio for the concave hull. The edge length ratio is a fraction of the length delta between the longest and shortest edges in the Delaunay Triangulation of the input points. A value of 1.0 produces the convex hull. A value of 0.0 produces a concave hull of minimum area that is still connected.
edgeLengthRatio | a length ratio value between 0 and 1 |
|
static |
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. This value can be used to determine a suitable length threshold value for computing a concave hull. A value from 2 to 4 times the uniform grid length seems to produce reasonable results.
geom | a geometry |