Splitting polygons using triangulation
✓ Published0🌍 Public
Aalpha-beta-soup
Last edited Oct 7, 2025
Created on Oct 7, 2025
This example shows polygon geometries subdivided into smaller triangles until each triangle’s area falls below a specified threshold. The code triangulates input polygons using Shapely’s `constrained_delaunay_triangles`, then recursively splits oversized triangles along the midpoint of their longest edge via a deque-based queue. It handles invalid or non-planar geometries with `make_valid`, `force_2d`, and `buffer(0)`, and processes test polygons defined in WKT format. The output is a generator of Shapely `Polygon` objects.
AI-generated description