def edge_separation(poly1, xf1, edge1, poly2, xf2):
    """Find the separation between poly1 and poly2 for a give edge normal on poly1."""
    vertices1 = poly1._vertices
    vertices2 = poly2._vertices

    normals1 = poly1._normals

    assert(0 <= edge1 < len(vertices1))

    # Convert normal from poly1's frame into poly2's frame.
    normal1_world = xf1._rotation * normals1[edge1]
    normal1 = xf2._rotation.mul_t(normal1_world)

    # Find support vertex on poly2 for -normal.
    dots = [v.dot(normal1) for v in vertices2]
    min_dot = min(dots)
    index = dots.index(min_dot)

    v1 = xf1 * vertices1[edge1]
    v2 = xf2 * vertices2[index]
    separation = (v2 - v1) * normal1_world
    return separation