shapely.constrained_delaunay_triangles

shapely.constrained_delaunay_triangles#

constrained_delaunay_triangles(geometry, **kwargs)#

Compute the constrained Delaunay triangulation of polygons.

Note

‘constrained_delaunay_triangles’ requires at least GEOS 3.10.0.

A constrained Delaunay triangulation requires the edges of the input polygon(s) to be in the set of resulting triangle edges. An unconstrained delaunay triangulation only triangulates based on the vertices, hence triangle edges could cross polygon boundaries.

Added in version 2.1.0.

Parameters:
geometryGeometry or array_like
**kwargs

For other keyword-only arguments, see the NumPy ufunc docs.

Returns:
GeometryCollection or array of GeometryCollections
  • GeometryCollection of polygons, given polygonal input

  • Empty GeometryCollection, given non-polygonal input

Examples

>>> import shapely
>>> from shapely import MultiPoint, MultiPolygon, Polygon
>>> shapely.constrained_delaunay_triangles(Polygon([(10, 10), (20, 40), (90, 90), (90, 10), (10, 10)]))
<GEOMETRYCOLLECTION (POLYGON ((90 10, 20 40, 90 90, 90 10)), POLYGON ((20 40...>
>>> shapely.constrained_delaunay_triangles(Polygon())
<GEOMETRYCOLLECTION EMPTY>
>>> shapely.constrained_delaunay_triangles(MultiPolygon([Polygon(((50, 30), (60, 30), (100, 100), (50, 30))), Polygon(((10, 10), (20, 40), (90, 90), (90, 10), (10, 10)))]))
<GEOMETRYCOLLECTION (POLYGON ((50 30, 100 100, 60 30, 50 30)), POLYGON ((90 ...>
>>> shapely.constrained_delaunay_triangles(MultiPolygon())
<GEOMETRYCOLLECTION EMPTY>
>>> shapely.constrained_delaunay_triangles(MultiPoint([(50, 30), (51, 30), (60, 30), (100, 100)]))
<GEOMETRYCOLLECTION EMPTY>