Esempio n. 1
0
def polyedge_from_mesh_to_submesh(polyedge, mesh, submesh,
                                  match_mesh_to_submesh):
    # or from supermesh to mesh
    trans_mesh = mesh.copy()
    old_vkeys_to_new_vkeys = delete_strip(trans_mesh, skey)
    submesh_polyedge = [
        match_mesh_to_submesh[old_vkeys_to_new_vkeys[vkey]]
        if vkey in old_vkeys_to_new_vkeys else vkey for vkey in polyedge
    ]
Esempio n. 2
0
    def delete(self):
        if self.grow:
            # use update polyedge
            print('Not Implemented')
            pass

        skey = self.mesh.edge_strip((self.lizard[0], self.lizard[1]))
        self.pivot()  # check that pivot ends along strip
        old_vkeys_to_new_vkeys = delete_strip(self.mesh, skey)
        self.lizard = [
            old_vkeys_to_new_vkeys[i] for i in self.lizard
        ]  # specify one when old_vkeys_to_new_vkeys[i] is a tuple
Esempio n. 3
0
def add_strip_to_other_mesh_via_submesh(mesh, skey, submesh, supermesh,
                                        match_mesh_to_submesh):

    mesh_polyedge = mesh.strip_side_polyedges(skey)[0]

    mesh_submesh = mesh.copy()
    old_vkeys_to_new_vkeys = delete_strip(mesh_submesh, skey)
    submesh_polyedge = [
        match_mesh_to_submesh[old_vkeys_to_new_vkeys[vkey]]
        if vkey in old_vkeys_to_new_vkeys else vkey for vkey in polyedge
    ]

    super_mesh_polyedge
Esempio n. 4
0
 def map_mesh_to_submesh(self, mesh):
     submesh = self.get_submesh()
     mesh_to_map_mesh = {vkey: vkey for vkey in mesh.vertices()}
     strips_to_delete = submesh_and_distance_and_deletion_rules_between_2_meshes(
         mesh, submesh)[0][2][mesh]
     map_mesh = mesh.copy()
     for skey in strips_to_delete:
         old_vkeys_to_new_vkeys = delete_strip(map_mesh, skey)
         mesh_to_map_mesh = {
             mesh_key: old_vkeys_to_new_vkeys[map_mesh_key]
             if map_mesh_key in old_vkeys_to_new_vkeys else map_mesh_key
             for mesh_key, map_mesh_key in mesh_to_map_mesh.items()
         }
     matches = matches_between_ismorphic_meshes(map_mesh,
                                                submesh,
                                                boundary_edge_data=True)
     match_0 = list(matches)[0]
     mesh_to_submesh = {
         mesh_key: match_0[map_mesh_key]
         for mesh_key, map_mesh_key in mesh_to_map_mesh.items()
     }
     return mesh_to_submesh
Esempio n. 5
0
def reverse_deletion_to_deletion_rules(mesh, submesh, strips_to_delete):
    skey_to_polyedge = {
        skey: mesh.strip_side_polyedges(skey)[0]
        for skey in strips_to_delete
    }

    trimmed_mesh = mesh.copy()
    for skey in strips_to_delete:
        old_vkeys_to_new_vkeys = delete_strip(trimmed_mesh, skey)
        skey_to_polyedge = {
            skey: [
                old_vkeys_to_new_vkeys[vkey]
                if vkey in old_vkeys_to_new_vkeys else vkey
                for vkey in polyedge
            ]
            for skey, polyedge in skey_to_polyedge.items()
        }

    # find equivalent in submesh
    matches = matches_between_ismorphic_meshes(trimmed_mesh,
                                               submesh,
                                               boundary_edge_data=False)
    match_0 = list(matches)[0]  # only one of the matches is selected

    # remap polyedge using match found in submesh
    skey_to_polyedge = {
        skey: [match_0[vkey] for vkey in polyedge]
        for skey, polyedge in skey_to_polyedge.items()
    }

    # avoid ismorphisms between polyedges due to flips, and offsets for closed polyedges
    skey_to_polyedge = {
        skey: remove_isomorphism_in_polyedge(polyedge)
        for skey, polyedge in skey_to_polyedge.items()
    }

    return skey_to_polyedge