Ejemplo n.º 1
0
def combine_meshes(mesh1, mesh2, ensure_continuity = False):
    """
    Combine two meshes into one disconnected mesh. This function
    relies on the user to make sure that nothing weird is going on.
    for example, the meshes probably should not intersect. I'm not
    sure what would happen if they do! Also, I assume that all
    the meshes are linear (linear mapping from real to reference space).

    Also, this function does not apply any mappings -- it assumes they have
    already been applied to the elements of the subordinate meshes.
    """
    vertices = copy.copy(mesh1.vertices)
    vertices.extend(mesh2.vertices)
    elements = copy.copy(mesh1.elements)
    elements.extend(mesh2.elements)

    result =  Mesh(vertices, elements)
    if ensure_continuity:
        result.condense_duplicate_vertices()
    return result