cartagen.remove_flat_vertices#
- remove_flat_vertices(polygon, tolerance=8.0)#
Removes flat vertices from a polygon.
A vertex is considered flat when the interior angle it forms with its two neighbours is close to 180°, meaning the three points are nearly collinear and the vertex brings no geometric information. Removing such vertices simplifies the polygon without altering its shape.
- Parameters:
- Returns:
Examples
>>> polygon = Polygon([(0, 0), (0.5, 0), (1, 0), (1, 1), (0, 1)]) >>> remove_flat_vertices(polygon) <POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))>