def focus_score(
    state: state_def.State, a: Union[str, list[str]], b: str, visualize=False
):
    """
    The how much objects in a focus on b
    """
    scene = state.trimesh_scene
    if isinstance(a, str):
        a = [a]

    a_meshes = iu.meshes_from_names(scene, a)
    a_blender_objs = iu.blender_objs_from_names(a)
    b_mesh = iu.meshes_from_names(scene, b)[0]

    a_polys = [iu.project_to_xy_poly(mesh) for mesh in a_meshes]
    b_poly = iu.project_to_xy_poly(b_mesh)

    if visualize:
        # Plotting the polygons and normals
        fig, ax = plt.subplots()
        if isinstance(b_poly, Polygon):
            x, y = b_poly.exterior.xy
            ax.fill(x, y, alpha=0.5, fc="red", ec="black", label="Polygon b")
        elif isinstance(b_poly, MultiPolygon):
            for sub_poly in b_poly.geoms:
                x, y = sub_poly.exterior.xy
                ax.fill(x, y, alpha=0.5, fc="red", ec="black", label="Polygon b")

    score = 0
    for a_poly, a_mesh, a_obj in zip(a_polys, a_meshes, a_blender_objs):
        axis = get_axis(state, a_obj)[1][:2]
        a_centroid = a_poly.centroid
        b_centroid = b_poly.centroid

        # turn centroids to np array
        a_centroid = np.array([a_centroid.x, a_centroid.y])
        b_centroid = np.array([b_centroid.x, b_centroid.y])

        focus_vec = b_centroid - a_centroid
        focus_vec /= np.linalg.norm(focus_vec)

        if visualize:
            # Plotting the polygons
            if isinstance(a_poly, Polygon):
                x, y = a_poly.exterior.xy
                ax.fill(x, y, alpha=0.5, fc="blue", ec="black", label="Polygon a")
            elif isinstance(a_poly, MultiPolygon):
                for sub_poly in a_poly.geoms:
                    x, y = sub_poly.exterior.xy
                    ax.fill(x, y, alpha=0.5, fc="blue", ec="black", label="Polygon a")

            # plot axis
            ax.arrow(
                a_centroid[0],
                a_centroid[1],
                axis[0],
                axis[1],
                head_width=0.15,
                head_length=0.25,
                fc="green",
                ec="green",
                label="Axis of a",
            )

            # Highlight centroid of a
            ax.plot(
                a_centroid[0], a_centroid[1], "o", color="black", label="Centroid of a"
            )

            # Plot the outward normal vector
            ax.arrow(
                a_centroid[0],
                a_centroid[1],
                focus_vec[0],
                focus_vec[1],
                head_width=0.15,
                head_length=0.25,
                fc="yellow",
                ec="yellow",
                label="Focus vector",
            )

        score += -np.dot(axis, focus_vec) / 2 + 0.5

    if visualize:
        # Set axis properties
        ax.set_title("Polygons, Focus Vector")
        ax.set_aspect("equal")
        ax.grid(True)
        # ax.legend(loc="upper left")
        plt.show()

    return score  # / len(a)

    The how much objects in a focus on b
    
infinigen/core/constraints/evaluator/node_impl/trimesh_geometry.py