def main(): args = parse_args() mesh = pymesh.load_mesh(args.input_mesh) wires = pymesh.wires.WireNetwork.create_from_file(args.path) path = chain_wires(wires) result = pymesh.minkowski_sum(mesh, path) pymesh.save_mesh(args.output_mesh, result)
def test_simple(self): input_mesh = generate_box_mesh( np.array([0, 0, 0]), np.array([1, 1, 1])); path = np.array([ [0, 0, 0], [1, 1, 1] ]); output_mesh = minkowski_sum(input_mesh, path); self.assertTrue(output_mesh.is_closed()); self.assertTrue(output_mesh.is_oriented()); self.assertTrue(output_mesh.num_boundary_edges == 0); input_bbox_min, input_bbox_max = input_mesh.bbox; output_bbox_min, output_bbox_max = output_mesh.bbox; self.assert_array_equal(input_bbox_min, output_bbox_min); self.assert_array_equal([1, 1, 1], output_bbox_max - input_bbox_max);
def test_simple(self): input_mesh = generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1])) path = np.array([[0, 0, 0], [1, 1, 1]]) output_mesh = minkowski_sum(input_mesh, path) self.assertTrue(output_mesh.is_closed()) self.assertTrue(output_mesh.is_oriented()) self.assertTrue(output_mesh.num_boundary_edges == 0) input_bbox_min, input_bbox_max = input_mesh.bbox output_bbox_min, output_bbox_max = output_mesh.bbox self.assert_array_equal(input_bbox_min, output_bbox_min) self.assert_array_equal([1, 1, 1], output_bbox_max - input_bbox_max)
def test_chain(self): input_mesh = generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1])) path = np.array([ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 0.0], ]) output_mesh = minkowski_sum(input_mesh, path) self.assertTrue(output_mesh.is_closed()) self.assertTrue(output_mesh.is_oriented()) self.assertEqual(1, output_mesh.num_components) self_intersections = detect_self_intersection(output_mesh) self.assertEqual(0, len(self_intersections))
def test_chain(self): input_mesh = generate_box_mesh( np.array([0, 0, 0]), np.array([1, 1, 1])); path = np.array([ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 0.0], ]); output_mesh = minkowski_sum(input_mesh, path); self.assertTrue(output_mesh.is_closed()); self.assertTrue(output_mesh.is_oriented()); self.assertEqual(1, output_mesh.num_components); self_intersections = detect_self_intersection(output_mesh); self.assertEqual(0, len(self_intersections));