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

Function extract_intersecting_faces

scripts/extract_self_intersecting_faces.py:11–24  ·  view source on GitHub ↗
(mesh, selection)

Source from the content-addressed store, hash-verified

9import pymesh
10
11def extract_intersecting_faces(mesh, selection):
12 face_pairs = pymesh.detect_self_intersection(mesh);
13 selected_faces = np.zeros(mesh.num_faces, dtype=bool);
14
15 if selection is not None:
16 selected_pairs = np.any(face_pairs == selection, axis=1);
17 face_pairs = face_pairs[selected_pairs];
18
19 selected_faces[face_pairs[:,0]] = True;
20 selected_faces[face_pairs[:,1]] = True;
21 faces = mesh.faces[selected_faces];
22 intersecting_mesh = pymesh.form_mesh(mesh.vertices, faces);
23 intersecting_mesh, __ = pymesh.remove_isolated_vertices(intersecting_mesh);
24 return intersecting_mesh;
25
26def parse_args():
27 parser = argparse.ArgumentParser(description=__doc__);

Callers 1

mainFunction · 0.85

Calls 3

form_meshMethod · 0.45

Tested by

no test coverage detected