GEOS 3.11.1
Public Member Functions | Static Public Member Functions | List of all members
geos::simplify::PolygonHullSimplifier Class Reference

#include <PolygonHullSimplifier.h>

Public Member Functions

 PolygonHullSimplifier (const Geometry *geom, bool bOuter)
 
void setVertexNumFraction (double p_vertexNumFraction)
 
void setAreaDeltaRatio (double p_areaDeltaRatio)
 
std::unique_ptr< GeometrygetResult ()
 

Static Public Member Functions

static std::unique_ptr< Geometryhull (const Geometry *geom, bool isOuter, double vertexNumFraction)
 
static std::unique_ptr< GeometryhullByAreaDelta (const Geometry *geom, bool isOuter, double areaDeltaRatio)
 

Detailed Description

Computes topology-preserving simplified hulls of polygonal geometry. Both outer and inner hulls can be computed. Outer hulls contain the input geometry and are larger in area. Inner hulls are contained by the input geometry and are smaller in area. In both the hull vertices are a subset of the input vertices. The hull construction attempts to minimize the area difference with the input geometry. Hulls are generally concave if the input is. Computed hulls are topology-preserving: they do not contain any self-intersections or overlaps, so the result polygonal geometry is valid.

Polygons with holes and MultiPolygons are supported. The result has the same geometric type and structure as the input.

The number of vertices in the computed hull is determined by a target parameter. Two parameters are supported:

The algorithm ensures that the result does not cause the target parameter to be exceeded. This allows computing outer or inner hulls with a small area delta ratio as an effective way of removing narrow gores and spikes.

Author
Martin Davis

Constructor & Destructor Documentation

◆ PolygonHullSimplifier()

geos::simplify::PolygonHullSimplifier::PolygonHullSimplifier ( const Geometry geom,
bool  bOuter 
)
inline

Creates a new instance to compute a simplified hull of a polygonal geometry. An outer or inner hull is computed depending on the value of "isOuter".

Parameters
geomthe polygonal geometry to process
bOuterindicates whether to compute an outer or inner hull

Member Function Documentation

◆ getResult()

std::unique_ptr< Geometry > geos::simplify::PolygonHullSimplifier::getResult ( )

Gets the result polygonal hull geometry.

Returns
the polygonal geometry for the hull

◆ hull()

static std::unique_ptr< Geometry > geos::simplify::PolygonHullSimplifier::hull ( const Geometry geom,
bool  isOuter,
double  vertexNumFraction 
)
static

Computes a topology-preserving simplified hull of a polygonal geometry, with hull shape determined by a target parameter specifying the fraction of the input vertices retained in the result. Larger values compute less concave results. A value of 1 produces the convex hull; a value of 0 produces the original geometry. Either outer or inner hulls can be computed.

Parameters
geomthe polygonal geometry to process
isOuterindicates whether to compute an outer or inner hull
vertexNumFractionthe target fraction of number of input vertices in result
Returns
the hull geometry

◆ hullByAreaDelta()

static std::unique_ptr< Geometry > geos::simplify::PolygonHullSimplifier::hullByAreaDelta ( const Geometry geom,
bool  isOuter,
double  areaDeltaRatio 
)
static

Computes a topology-preserving simplified hull of a polygonal geometry, with hull shape determined by a target parameter specifying the ratio of maximum difference in area to original area. Larger values compute less concave results. A value of 0 produces the original geometry. Either outer or inner hulls can be computed..

Parameters
geomthe polygonal geometry to process
isOuterindicates whether to compute an outer or inner hull
areaDeltaRatiothe target ratio of area difference to original area
Returns
the hull geometry

◆ setAreaDeltaRatio()

void geos::simplify::PolygonHullSimplifier::setAreaDeltaRatio ( double  p_areaDeltaRatio)

Sets the target maximum ratio of the change in area of the result to the input area. The value must be 0 or greater.

Parameters
p_areaDeltaRatioa ratio of the change in area of the result

◆ setVertexNumFraction()

void geos::simplify::PolygonHullSimplifier::setVertexNumFraction ( double  p_vertexNumFraction)

Sets the target fraction of input vertices which are retained in the result. The value should be in the range [0,1].

Parameters
p_vertexNumFractiona fraction of the number of input vertices

The documentation for this class was generated from the following file: