def draw_polygon(polygon):
    """
    Visualize the polygon with matplot lib
    Args:
        polygon: a list of 2D points

    Returns: None

    """
    import matplotlib.pyplot as plt

    # Create the rectangle
    rectangle_points = np.array(polygon)
    # Extract the points for easier plotting
    x_rect, y_rect = rectangle_points.T

    # Extract the original midpoints

    # Plot the rectangle
    plt.figure(figsize=(8, 8))
    plt.plot(*zip(*np.append(rectangle_points, [rectangle_points[0]], axis=0)), marker='o', label='Rectangle Vertices')
    plt.fill(
        *zip(*np.append(rectangle_points, [rectangle_points[0]], axis=0)), alpha=0.3
    )  # Fill the rectangle with light opacity

    # Plot the original midpoints
    # plt.scatter(x_mid, y_mid, color='red', zorder=5, label='Midpoints')

    # Set equal scaling and labels
    plt.axis('equal')
    plt.xlabel('X-coordinate')
    plt.ylabel('Y-coordinate')
    plt.title('Visualization of the Rectangle and Input Points')
    plt.legend()
    plt.grid(True)
    plt.show()

    Visualize the polygon with matplot lib
    Args:
        polygon: a list of 2D points

    Returns: None

    
metadrive/utils/utils.py