def is_vertically_contained(poly_a, poly_b):
    """
    Check if polygon A is vertically contained within polygon B, ignoring X-axis spillover.

    Parameters:
    poly_a (Polygon): Polygon A.
    poly_b (Polygon): Polygon B.

    Returns:
    bool: True if A is vertically contained within B.
    """
    y_coords_a = [point[1] for point in poly_a.exterior.coords]
    y_coords_b = [point[1] for point in poly_b.exterior.coords]

    # Check vertical containment along the Y-axis
    min_a, max_a = min(y_coords_a), max(y_coords_a)
    min_b, max_b = min(y_coords_b), max(y_coords_b)

    return min_b <= min_a and max_a <= max_b

    Check if polygon A is vertically contained within polygon B, ignoring X-axis spillover.

    Parameters:
    poly_a (Polygon): Polygon A.
    poly_b (Polygon): Polygon B.

    Returns:
    bool: True if A is vertically contained within B.
    
infinigen/core/constraints/example_solver/geometry/stability.py