def get_cardinal_planes_bbox(vertices: np.ndarray):
    """
    Get the mid dividing planes. Assumes vertices form a box
    """
    centroid = np.mean(vertices, axis=0)

    # Calculate the covariance matrix and principal components
    centered_vertices = vertices - centroid
    cov_matrix = np.cov(centered_vertices[:, :2].T)  # Covariance on XY plane
    eigenvalues, eigenvectors = np.linalg.eigh(cov_matrix)

    # Sort eigenvectors based on eigenvalues
    order = eigenvalues.argsort()[::-1]
    principal_axes = eigenvectors[:, order]

    # Determine the longer and shorter plane normals and normalize them
    if eigenvalues[order[0]] > eigenvalues[order[1]]:
        longer_plane_normal = np.array([principal_axes[0, 1], principal_axes[1, 1], 0])
        shorter_plane_normal = np.array([principal_axes[0, 0], principal_axes[1, 0], 0])
    else:
        longer_plane_normal = np.array([principal_axes[0, 0], principal_axes[1, 0], 0])
        shorter_plane_normal = np.array([principal_axes[0, 1], principal_axes[1, 1], 0])

    longer_plane_normal /= np.linalg.norm(longer_plane_normal)
    shorter_plane_normal /= np.linalg.norm(shorter_plane_normal)
    return [
        [Vector(centroid), Vector(longer_plane_normal)],
        [Vector(centroid), Vector(shorter_plane_normal)],
    ]

    Get the mid dividing planes. Assumes vertices form a box
    
infinigen/core/constraints/evaluator/node_impl/trimesh_geometry.py