def get_rot(ind):
        """
        Get the rotation axis and angle needed to align the object's plane with the assigned plane.
        """
        try:
            a = obj_planes[ind][0]
            b = assigned_planes[ind][0]
        except IndexError:
            raise ValueError(f"Invalid {ind=} {obj_planes=} {assigned_planes=}")

        a_plane = obj_planes[ind]
        b_plane = assigned_planes[ind]
        rev_normal = rev_normals[ind]
        a_obj = bpy.data.objects[a]
        b_obj = bpy.data.objects[b]

        a_poly_index = a_plane[1]
        a_poly = a_obj.data.polygons[a_poly_index]
        b_poly_index = b_plane[1]
        b_poly = b_obj.data.polygons[b_poly_index]
        plane_normal_a = butil.global_polygon_normal(a_obj, a_poly)
        plane_normal_b = butil.global_polygon_normal(b_obj, b_poly, rev_normal)
        plane_normal_b = -plane_normal_b
        rotation_axis = np.cross(plane_normal_a, plane_normal_b)

        if not np.isclose(np.linalg.norm(rotation_axis), 0, atol=1e-03):
            rotation_axis = rotation_axis / np.linalg.norm(rotation_axis)
        else:
            rotation_axis = np.array([0, 0, 1])
        dot = plane_normal_a.dot(plane_normal_b)
        rotation_angle = np.arccos(np.clip(dot, -1, 1))
        if np.isnan(rotation_angle):
            raise ValueError(f"Invalid {rotation_angle=}")
        return a, b, rotation_axis, rotation_angle, plane_normal_b

        Get the rotation axis and angle needed to align the object's plane with the assigned plane.
        
infinigen/core/constraints/example_solver/geometry/dof.py