def coplanarity_cost(scene, a: Union[str, list[str]]):
    """
    Computes the coplanarity cost between a and b
    """
    if isinstance(a, str):
        a = [a]

    iu.meshes_from_names(scene, a)
    a_objs = iu.blender_objs_from_names(a)

    # Order objects by principal axis
    ordered_objects = iu.order_objects_by_principal_axis(a_objs)

    all_total_costs = []  # To store the sum of angle and distance costs for each optimal matching

    # Iterate over pairs of consecutive objects
    for i in range(len(ordered_objects) - 1):
        all_total_costs.append(
            coplanarity_cost_pair(
                scene, ordered_objects[i].name, ordered_objects[i + 1].name
            )
        )

    # Calculate the final cost as the sum of the remaining costs
    final_cost = sum(all_total_costs) / len(a_objs)

    return final_cost

    Computes the coplanarity cost between a and b
    
infinigen/core/constraints/evaluator/node_impl/trimesh_geometry.py