GEOS
3.14.0dev
|
#include <ConcaveHull.h>
Public Member Functions | |
ConcaveHull (const Geometry *geom) | |
void | setMaximumEdgeLength (double edgeLength) |
void | setMaximumEdgeLengthRatio (double edgeLengthRatio) |
void | setHolesAllowed (bool holesAllowed) |
void | setAlpha (double newAlpha) |
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) |
static std::unique_ptr< Geometry > | alphaShape (const Geometry *geom, double alpha, bool isHolesAllowed) |
Constructs a concave hull of a set of points. The hull is constructed by removing border triangles of the Delaunay Triangulation of the points as long as their "size" is larger than the target criterion. 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 by calling setHolesAllowed(boolean).
|
static |
Computes the alpha shape of a geometry as a polygon. The alpha parameter is the radius of the eroding disc.
geom | the input geometry |
alpha | the radius of the eroding disc |
isHolesAllowed | whether holes are allowed in the result |
|
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::setAlpha | ( | double | newAlpha | ) |
Sets the alpha parameter to compute an alpha shape of the input. Alpha is the radius of the eroding disc. Border triangles with circumradius greater than alpha are removed.
newAlpha | the alpha radius |
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 |