def sort_points_anticlockwise(points):
    """
    Make points anticlockwise! For now, it only works for clockwise polygon!
    Args:
        points: list of 2D point

    Returns: points ordered in anticlockwise

    """
    points = np.array(points)
    centroid = points.mean(axis=0)

    angles = np.arctan2(points[:, 1] - centroid[1], points[:, 0] - centroid[0])
    sort_order = angles.argsort()
    return points[sort_order][::-1]

    Make points anticlockwise! For now, it only works for clockwise polygon!
    Args:
        points: list of 2D point

    Returns: points ordered in anticlockwise

    
metadrive/utils/vertex.py