()
| 16 | return parser.parse_args(); |
| 17 | |
| 18 | def main(): |
| 19 | args = parse_args(); |
| 20 | mesh = pymesh.load_mesh(args.input_mesh); |
| 21 | |
| 22 | pymesh.is_vertex_manifold(mesh); |
| 23 | pymesh.is_edge_manifold(mesh); |
| 24 | |
| 25 | faces = mesh.faces; |
| 26 | edge_manifold = mesh.get_attribute("edge_manifold").reshape((-3, |
| 27 | mesh.vertex_per_face)); |
| 28 | is_edge_nonmanifold = np.any(edge_manifold==0, axis=1); |
| 29 | involved_faces = faces[is_edge_nonmanifold]; |
| 30 | mesh.add_attribute("faces_adj_nonmanifold_edge"); |
| 31 | mesh.set_attribute("faces_adj_nonmanifold_edge", is_edge_nonmanifold); |
| 32 | |
| 33 | print("Faces adjacent to nonmanifold edges"); |
| 34 | print("Indices: {}".format(np.arange(mesh.num_faces)[is_edge_nonmanifold])); |
| 35 | print(involved_faces); |
| 36 | pymesh.save_matrix("nonmanifold_edges.dmat", involved_faces); |
| 37 | |
| 38 | vertex_manifold = mesh.get_attribute("vertex_manifold").ravel(); |
| 39 | is_vertex_nonmanifold = np.any(vertex_manifold[faces] == 0, axis=1); |
| 40 | involved_faces = faces[is_vertex_nonmanifold]; |
| 41 | mesh.add_attribute("faces_adj_nonmanifold_vertex"); |
| 42 | mesh.set_attribute("faces_adj_nonmanifold_vertex", is_vertex_nonmanifold); |
| 43 | |
| 44 | print("Faces adjacent to nonmanifold vertices"); |
| 45 | print("Indices: {}".format(np.arange(mesh.num_faces)[is_vertex_nonmanifold])); |
| 46 | print(involved_faces); |
| 47 | pymesh.save_matrix("nonmanifold_vertices.dmat", involved_faces); |
| 48 | |
| 49 | pymesh.save_mesh(args.output_mesh, mesh, *mesh.attribute_names); |
| 50 | |
| 51 | if args.debug_output is not None: |
| 52 | debug_faces = faces[is_edge_nonmanifold]; |
| 53 | debug_mesh = pymesh.form_mesh(mesh.vertices, debug_faces); |
| 54 | pymesh.save_mesh(args.debug_output, debug_mesh); |
| 55 | |
| 56 | if __name__ == "__main__": |
| 57 | main(); |
no test coverage detected