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

Function main

scripts/highlight_self_intersection.py:17–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 return parser.parse_args();
16
17def main():
18 args = parse_args();
19 mesh = pymesh.load_mesh(args.input_mesh);
20
21 intersecting_faces = pymesh.detect_self_intersection(mesh);
22 intersection_marker = np.zeros(mesh.num_faces);
23 for i,face_pair in enumerate(intersecting_faces):
24 intersection_marker[face_pair] = i+1;
25
26 mesh.add_attribute("intersecting_faces");
27 mesh.set_attribute("intersecting_faces", intersection_marker);
28 mesh.add_attribute("is_self_intersecting");
29 mesh.set_attribute("is_self_intersecting", intersection_marker > 0);
30 pymesh.save_mesh(args.output_mesh, mesh, "intersecting_faces",
31 "is_self_intersecting");
32
33if __name__ == "__main__":
34 main();

Callers 1

Calls 7

enumerateFunction · 0.85
parse_argsFunction · 0.70
load_meshMethod · 0.45
add_attributeMethod · 0.45
set_attributeMethod · 0.45
save_meshMethod · 0.45

Tested by

no test coverage detected