round_polygon#
- zeroheliumkit.src.utils.round_polygon(polygon: Polygon, round_radius: float, **kwargs) Polygon[source]#
Rounds the corners of a polygon by applying a buffer operation.
- Parameters:
polygon (Polygon) – The input polygon to round.
round_radius (float) – The radius of the rounding.
**kwargs – Additional keyword arguments to pass to the buffer method. See [Shapely buffer docs](https://shapely.readthedocs.io/en/stable/reference/shapely.buffer.html) for additional keyword arguments.
- Returns:
A new polygon with rounded corners.
- Return type:
Polygon
Example
>>> polygon = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]) >>> rounded_polygon = round_polygon(polygon, round_radius=0.1) >>> print(rounded_polygon) POLYGON ((0.1 0, 0.9 0, 1 0.1, 1 0.9, 0.9 1, 0.1 1, 0 0.9, 0 0.1, 0.1 0))