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

Function main

scripts/signed_volume.py:16–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 return parser.parse_args();
15
16def main():
17 args = parse_args();
18 mesh = pymesh.load_mesh(args.input_mesh);
19 assert(mesh.dim == 3);
20
21 total_vol = 0.0;
22 origin = np.zeros(3);
23 vertices = mesh.vertices;
24 for f in mesh.faces:
25 corners = vertices[f];
26 volume = np.dot(np.cross(corners[0], corners[1]), corners[2]);
27 total_vol += volume;
28
29 total_vol /= 6.0;
30 print("Total volume: {}".format(total_vol));
31
32if __name__ == "__main__":
33 main();

Callers 1

signed_volume.pyFile · 0.70

Calls 2

parse_argsFunction · 0.70
load_meshMethod · 0.45

Tested by

no test coverage detected