def _bbox(pts):
    """Find the AABB bounding box for a set of points"""
    x, y = pts[0]
    ax, ay, bx, by = x, y, x, y
    for i in range(1, len(pts)):
        x, y = pts[i]
        ax = x if x < ax else ax
        ay = y if y < ay else ay
        bx = x if x > bx else bx
        by = y if y > by else by
    return ax, ay, bx, by