def split_gt(): g = GTGraph() g.add_edge_list(adjacency) component_labels = label_components(g, directed=False)[0].a components = group(component_labels) result = mesh.submesh(components, only_watertight=only_watertight) return result
def components_graphtool(): g = GTGraph() # make sure all the nodes are in the graph if min_len <= 1: g.add_vertex(node_count) g.add_edge_list(edges) component_labels = label_components(g, directed=False)[0].a components = grouping.group(component_labels, min_len=min_len) return components
def split_gt(): g = GTGraph() if not only_watertight: # same as above, for single triangles with no adjacency g.add_vertex(len(mesh.faces)) g.add_edge_list(adjacency) component_labels = label_components(g, directed=False)[0].a components = group(component_labels) result = mesh.submesh(components, only_watertight=only_watertight) return result
def components_graphtool(): """ Find connected components using graphtool """ g = GTGraph() # make sure all the nodes are in the graph g.add_vertex(node_count) # add the edge list g.add_edge_list(edges) labels = np.array(label_components(g, directed=False)[0].a, dtype=np.int64)[:node_count] # we have to remove results that contain nodes outside # of the specified node set and reindex contained = np.zeros(node_count, dtype=np.bool) contained[nodes] = True index = np.arange(node_count, dtype=np.int64)[contained] components = grouping.group(labels[contained], min_len=min_len) components = np.array([index[c] for c in components]) return components
def facets_gt(): graph_parallel = GTGraph() graph_parallel.add_edge_list(face_idx[parallel]) connected = label_components(graph_parallel, directed=False)[0].a facets_idx = group(connected, min_len=2) return facets_idx