def set_up_verts(self, vertices, edges, faces, compare_func): if int(self.vertex_mode) == 0: bm = bmesh_from_pydata(vertices, edges, faces, normal_update=True) vals = [tuple(v.normal) for v in bm.verts] bm.free() compare_func = equal_vectors elif int(self.vertex_mode) == 1: vals = adjacent_edg_pol(vertices, faces) elif int(self.vertex_mode) == 3: vals = adjacent_edg_pol(vertices, edges) return vals, compare_func
def connected_edges(verts, edges): '''edges conected to each edge''' v_adja = adjacent_edg_pol(verts, edges) vals = [] for e in edges: adj = [] for c in e: adj.extend(v_adja[c]) adj.remove(e) vals.append(adj) return vals
def pols_neighbor(verts, pols): v_adj = adjacent_edg_pol(verts, pols) vals = [] for pol in pols: pol_adj = [] for c in pol: for related_pol in v_adj[c]: if not related_pol in pol_adj: pol_adj.append(related_pol) pol_adj.remove(pol) vals.append(pol_adj) return vals
def connected_edges(verts, edges): ''' edges conected to each edge vertices: list as [vertex, vertex, ...], being each vertex [float, float, float]. edges: list as [edge, edge,..], being each edge [int, int]. returns edges connected to each edge as [[edge, edge,...],[edge,...],...] ''' v_adjacent = adjacent_edg_pol(verts, edges) vals = [] for edge in edges: adj_edges = [] for v_ind in edge: adj_edges.extend(v_adjacent[v_ind]) adj_edges.remove(edge) vals.append(adj_edges) return vals
def pols_neighbor(verts, pols): ''' returns the polygons that share one edges with each polygon [[pol, pol,..], [pol,..]] pols: list as [polygon, polygon,..], being each polygon [int, int, ...]. ''' v_adj = adjacent_edg_pol(verts, pols) vals = [] for pol in pols: pol_adj = [] for v_id in pol: for related_pol in v_adj[v_id]: if not related_pol in pol_adj: pol_adj.append(related_pol) pol_adj.remove(pol) vals.append(pol_adj) return vals