def main(): args = parse_args() mesh = pymesh.load_mesh(args.input_mesh) mesh = pymesh.retriangulate(mesh, args.max_area, not args.no_split_boundary, not args.no_steiner_points) pymesh.save_mesh(args.output_mesh, mesh)
def main(): args = parse_args(); mesh = pymesh.load_mesh(args.input_mesh); mesh = pymesh.retriangulate(mesh, args.max_area, not args.no_split_boundary, not args.no_steiner_points); pymesh.save_mesh(args.output_mesh, mesh);
def test_refine(self): vertices = np.array([[0, 0, 0], [1, 0, 1], [1, 1, 1], [0, 1, 0]], dtype=float) faces = np.array([[0, 1, 2], [0, 2, 3]]) in_mesh = pymesh.form_mesh(vertices, faces) out_mesh = retriangulate(in_mesh, 0.1) self.assertLess(in_mesh.num_vertices, out_mesh.num_vertices) self.assertLess(in_mesh.num_faces, out_mesh.num_faces) in_mesh.add_attribute("face_area") in_areas = in_mesh.get_attribute("face_area") out_mesh.add_attribute("face_area") out_areas = out_mesh.get_attribute("face_area") self.assertAlmostEqual(np.sum(in_areas), np.sum(out_areas))
def test_refine(self): vertices = np.array([ [0, 0, 0], [1, 0, 1], [1, 1, 1], [0, 1, 0] ], dtype=float); faces = np.array([ [0, 1, 2], [0, 2, 3] ]); in_mesh = pymesh.form_mesh(vertices, faces); out_mesh = retriangulate(in_mesh, 0.1); self.assertLess(in_mesh.num_vertices, out_mesh.num_vertices); self.assertLess(in_mesh.num_faces, out_mesh.num_faces); in_mesh.add_attribute("face_area"); in_areas = in_mesh.get_attribute("face_area"); out_mesh.add_attribute("face_area"); out_areas = out_mesh.get_attribute("face_area"); self.assertAlmostEqual(np.sum(in_areas), np.sum(out_areas));