geos::algorithm::hull::ConcaveHullOfPolygons Class Reference

`#include <ConcaveHullOfPolygons.h>`

## Public Member Functions

| ConcaveHullOfPolygons (const Geometry *geom)
void | setMaximumEdgeLength (double edgeLength)
void | setMaximumEdgeLengthRatio (double edgeLengthRatio)
void | setHolesAllowed (bool p_isHolesAllowed)
void | setTight (bool p_isTight)
std::unique_ptr< Geometry > | getHull ()
std::unique_ptr< Geometry > | getFill ()

## Static Public Member Functions

static std::unique_ptr< Geometry > | concaveHullByLength (const Geometry *polygons, double maxLength)
static std::unique_ptr< Geometry > | concaveHullByLength (const Geometry *polygons, double maxLength, bool isTight, bool isHolesAllowed)
static std::unique_ptr< Geometry > | concaveHullByLengthRatio (const Geometry *polygons, double lengthRatio)
static std::unique_ptr< Geometry > | concaveHullByLengthRatio (const Geometry *polygons, double lengthRatio, bool isTight, bool isHolesAllowed)
static std::unique_ptr< Geometry > | concaveFillByLength (const Geometry *polygons, double maxLength)
static std::unique_ptr< Geometry > | concaveFillByLengthRatio (const Geometry *polygons, double lengthRatio)

## Detailed Description

Constructs a concave hull of a set of polygons, respecting the polygons as constraints. A concave hull is a possibly non-convex polygon containing all the input polygons. A given set of polygons has a sequence of hulls of increasing concaveness, determined by a numeric target parameter. The computed hull "fills the gap" between the polygons, and does not intersect their interior.

The concave hull is constructed by removing the longest outer edges of the Delaunay Triangulation of the space between the polygons, until the target criterion parameter is reached.

The target criteria are:

- Maximum Edge Length - the length of the longest edge between the polygons is no larger than this value.
- Maximum Edge Length Ratio - determine the Maximum Edge Length as a fraction of the difference between the longest and shortest edge lengths between the polygons. This normalizes the Maximum Edge Length to be scale-free. A value of 1 produces the convex hull; a value of 0 produces the original polygons.

The preferred criterion 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 concaveness present).

Optionally the concave hull can be allowed to contain holes, via setHolesAllowed().

The hull can be specified as being "tight", which means it follows the outer boundaries of the input polygons.

The input polygons must form a valid MultiPolygon (i.e. they must be non-overlapping).

Author
  Martin Davis

## Constructor & Destructor Documentation

## ConcaveHullOfPolygons()

geos::algorithm::hull::ConcaveHullOfPolygons::ConcaveHullOfPolygons | ( | const Geometry * | geom | ) |

Creates a new instance for a given geometry.

Parameters

  geom | the input geometry

## Member Function Documentation

## concaveFillByLength()

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::concaveFillByLength | ( | const Geometry * | polygons,
|  | double | maxLength )

static

Computes a concave fill area between a set of polygons, using the target criterion of maximum edge length.

Parameters

  polygons | the input polygons
  maxLength | the target maximum edge length

Returns
  the concave fill

## concaveFillByLengthRatio()

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::concaveFillByLengthRatio | ( | const Geometry * | polygons,
|  | double | lengthRatio )

static

Computes a concave fill area between a set of polygons, using the target criterion of maximum edge length ratio.

Parameters

  polygons | the input polygons
  lengthRatio | the target maximum edge length ratio

Returns
  the concave fill

## concaveHullByLength() [1/2]

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::concaveHullByLength | ( | const Geometry * | polygons,
|  | double | maxLength )

static

Computes a concave hull of set of polygons using the target criterion of maximum edge length.

Parameters

  polygons | the input polygons
  maxLength | the target maximum edge length

Returns
  the concave hull

## concaveHullByLength() [2/2]

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::concaveHullByLength | ( | const Geometry * | polygons,
|  | double | maxLength,
|  | bool | isTight,
|  | bool | isHolesAllowed )

static

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.

Parameters

  polygons | the input polygons
  maxLength | the target maximum edge length
  isTight | true if the hull should be tight to the outside of the polygons
  isHolesAllowed | true if holes are allowed in the hull polygon

Returns
  the concave hull

## concaveHullByLengthRatio() [1/2]

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::concaveHullByLengthRatio | ( | const Geometry * | polygons,
|  | double | lengthRatio )

static

Computes a concave hull of set of polygons using the target criterion of maximum edge length ratio.

Parameters

  polygons | the input polygons
  lengthRatio | the target maximum edge length ratio

Returns
  the concave hull

## concaveHullByLengthRatio() [2/2]

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::concaveHullByLengthRatio | ( | const Geometry * | polygons,
|  | double | lengthRatio,
|  | bool | isTight,
|  | bool | isHolesAllowed )

static

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.

Parameters

  polygons | the input polygons
  lengthRatio | the target maximum edge length ratio
  isTight | true if the hull should be tight to the outside of the polygons
  isHolesAllowed | true if holes are allowed in the hull polygon

Returns
  the concave hull

## getFill()

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::getFill | ( |  | ) |

Gets the concave fill, which is the area between the input polygons, subject to the concaveness control parameter.

Returns
  the concave fill

## getHull()

std::unique_ptr< Geometry > geos::algorithm::hull::ConcaveHullOfPolygons::getHull | ( |  | ) |

Gets the computed concave hull.

Returns
  the concave hull

## setHolesAllowed()

void geos::algorithm::hull::ConcaveHullOfPolygons::setHolesAllowed | ( | bool | p_isHolesAllowed | ) |

Sets whether holes are allowed in the concave hull polygon.

Parameters

  p_isHolesAllowed | true if holes are allowed in the result

## setMaximumEdgeLength()

void geos::algorithm::hull::ConcaveHullOfPolygons::setMaximumEdgeLength | ( | double | edgeLength | ) |

Sets the target maximum edge length for the concave hull. The length value must be zero or greater.

- The value 0.0 produces the input polygons.
- Larger values produce less concave results. Above a certain large value the result is the convex hull of the input.

The edge length ratio provides a scale-free parameter which is intended to produce similar concave results for a variety of inputs.

Parameters

  edgeLength | a non-negative length

## setMaximumEdgeLengthRatio()

void geos::algorithm::hull::ConcaveHullOfPolygons::setMaximumEdgeLengthRatio | ( | double | edgeLengthRatio | ) |

Sets the target maximum edge length ratio for the concave hull. The edge length ratio is a fraction of the difference between the longest and shortest edge lengths in the Delaunay Triangulation of the area between the input polygons. (Roughly speaking, it is a fraction of the difference between the shortest and longest distances between the input polygons.) It is a value in the range 0 to 1.

- The value 0.0 produces the original input polygons.
- The value 1.0 produces the convex hull.

Parameters

  edgeLengthRatio | a length factor value between 0 and 1

## setTight()

void geos::algorithm::hull::ConcaveHullOfPolygons::setTight | ( | bool | p_isTight | ) |

Sets whether the boundary of the hull polygon is kept tight to the outer edges of the input polygons.

Parameters

  p_isTight | true if the boundary is kept tight

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

- ConcaveHullOfPolygons.h