def cut_polygon_along_parallel_edges(polygon):
    """
    (Deprecated) Given a polygon, cut it into several slices. This is for creating the crosswalk.
    Args:
        polygon: a list of 2D points,

    Returns: polygon pieces, which forms the original polygon after being combined.

    """
    # Your original polygon
    # Make sure to replace this with your actual polygon
    raise DeprecationWarning("Stop using this. Not robust enough")
    polygon = Polygon(polygon)
    # try:
    ret = find_longest_parallel_edges(polygon)
    if ret is None:
        pieces = [polygon]
    else:
        edges, _ = ret
        # Identify the two parallel edges (assuming you have their coordinates)
        edge1 = LineString(edges[0])
        edge2 = LineString(edges[1])

        # Determine how many pieces you want to split the polygon into
        num_pieces = 5

        # Create cutting lines
        cutting_lines = []
        for i in range(1, num_pieces):
            # Calculate the points for the cutting line at the current split ratio
            ratio = i / num_pieces
            point1 = edge1.interpolate(ratio, normalized=True)
            point2 = edge2.interpolate(ratio, normalized=True)
            cutting_line = LineString([point1, point2])
            cutting_lines.append(cutting_line)

        # Split the polygon using the cutting lines
        pieces = [polygon]
        for cutting_line in cutting_lines:
            for piece in pieces:
                # Split each piece further
                splitted = split(piece, cutting_line)
                if len(splitted.geoms) > 1:  # If the piece was split
                    pieces.remove(piece)  # Remove the original piece
                    pieces.extend(splitted.geoms)  # Add the new pieces
    return [piece.exterior.coords for piece in pieces][::2]

    (Deprecated) Given a polygon, cut it into several slices. This is for creating the crosswalk.
    Args:
        polygon: a list of 2D points,

    Returns: polygon pieces, which forms the original polygon after being combined.

    
metadrive/utils/shapely_utils/geom.py