geos::triangulate::polygon::PolygonEarClipper Class Reference

`#include <PolygonEarClipper.h>`

## Public Member Functions

| PolygonEarClipper (const geom::CoordinateSequence &polyShell)
void | setSkipFlatCorners (bool p_isFlatCornersSkipped)
void | compute (TriList< Tri > &triList)
std::unique_ptr< Polygon > | toGeometry () const

## Static Public Member Functions

static void | triangulate (const geom::CoordinateSequence &polyShell, TriList< Tri > &triListResult)

## Detailed Description

Triangulates a polygon using the Ear-Clipping technique. The polygon is provided as a closed list of contiguous vertices defining its boundary. The vertices must have clockwise orientation.

The polygon boundary must not self-cross, but may self-touch at points or along an edge. It may contain repeated points, which are treated as a single vertex. By default every vertex is triangulated, including ones which are "flat" (the adjacent segments are collinear). These can be removed by setting setSkipFlatCorners(boolean)

The polygon representation does not allow holes. Polygons with holes can be triangulated by preparing them with `PolygonHoleJoiner`.

Author
  Martin Davis

## Constructor & Destructor Documentation

## PolygonEarClipper()

geos::triangulate::polygon::PolygonEarClipper::PolygonEarClipper | ( | const geom::CoordinateSequence & | polyShell | ) |

Creates a new ear-clipper instance.

Parameters

  polyShell | the polygon vertices to process

## Member Function Documentation

## setSkipFlatCorners()

void geos::triangulate::polygon::PolygonEarClipper::setSkipFlatCorners | ( | bool | p_isFlatCornersSkipped | ) |

Sets whether flat corners formed by collinear adjacent line segments are included in the triangulation. Skipping flat corners reduces the number of triangles in the output. However, it produces a triangulation which does not include all input vertices. This may be undesirable for downstream processes (such as computing a Constrained Delaunay Triangulation for purposes of computing the medial axis).

The default is to include all vertices in the result triangulation. This still produces a valid triangulation, with no zero-area triangles.

Note that repeated vertices are always skipped.

Parameters

  p_isFlatCornersSkipped | whether to skip collinear vertices

## triangulate()

void geos::triangulate::polygon::PolygonEarClipper::triangulate | ( | const geom::CoordinateSequence & | polyShell,
|  | TriList< Tri > & | triListResult )

static

Triangulates a polygon via ear-clipping.

Parameters

  polyShell | the vertices of the polygon
  triListResult | vector to fill in with the resultant Tri s

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

- PolygonEarClipper.h