def order_corners(corners):
    corners = list(corners)
    assert len(corners) == 4
    assert len(corners[0]) == 2
    ordered = []

    radii = [x ** 2 + y ** 2 for x, y in corners]
    i = np.argmin(radii)
    ordered.append(corners.pop(i))

    i = np.argmin([y for x, y in corners])
    ordered.append(corners.pop(i))

    i = np.argmax([x for x, y in corners])
    ordered.append(corners.pop(i))

    ordered += corners

    return ordered
bottom-left, bottom-right, top-right, top-left
dataset/ETHPy150Open mrterry/yoink/yoink/interp.py/order_corners