MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / cleanup

Function cleanup

scripts/repousse.py:62–85  ·  view source on GitHub ↗
(wires, logger)

Source from the content-addressed store, hash-verified

60 return wires;
61
62def cleanup(wires, logger):
63 if wires.num_vertices == 0:
64 return wires;
65 start_time = time();
66 tol = 1e-6;
67 vertices, edges, __ = pymesh.remove_duplicated_vertices_raw(
68 wires.vertices, wires.edges, tol);
69
70 # Remove duplicated edges.
71 ordered_edges = np.sort(edges, axis=1);
72 __, unique_edge_ids, __ = pymesh.unique_rows(ordered_edges);
73 edges = edges[unique_edge_ids, :];
74 wires.load(vertices, edges);
75
76 # Remove topologically degenerate edges.
77 is_not_topologically_degenerate = edges[:,0] != edges[:,1];
78 if not np.all(is_not_topologically_degenerate):
79 wires.filter_edges(is_not_topologically_degenerate);
80
81 finish_time = time();
82 t = finish_time - start_time;
83 logger.info("Cleanup running time: {}".format(t));
84
85 return wires;
86
87def uniform_sampling(wires):
88 bbox_min, bbox_max = wires.bbox;

Callers 1

mainFunction · 0.70

Calls 2

loadMethod · 0.80
filter_edgesMethod · 0.45

Tested by

no test coverage detected