def to_polygon_vertices(polygon: Polygon) -> Iterable[Point]: return chain(polygon.border.vertices, flatten(hole.vertices for hole in polygon.holes))
def to_polygon_edges(polygon: Polygon) -> Iterable[Segment]: return chain(to_contour_segments(polygon.border), flatten(map(to_contour_segments, polygon.holes)))
def to_multipolygon_vertices(multipolygon: Multipolygon) -> Iterable[Point]: return flatten(map(to_polygon_vertices, multipolygon.polygons))
def to_multiregion_edges(multiregion: Multiregion) -> Iterable[Segment]: return flatten(map(to_region_edges, multiregion))
def to_multipolygon_edges(multipolygon: Multipolygon) -> Iterable[Segment]: return flatten(map(to_polygon_edges, multipolygon.polygons))