示例#1
0
def main():
    args = parse_args()
    mesh = pymesh.load_mesh(args.input_mesh)
    slices = pymesh.slice_mesh(mesh, np.array(args.axis), args.N)

    slices = pymesh.merge_meshes(slices)
    pymesh.save_mesh(args.output_slices, slices, *slices.get_attribute_names())
示例#2
0
    def test_diag_box(self):
        mesh = generate_box_mesh(np.array([0, 0, 0]), np.array([1, 1, 1]))
        N = 5

        slices = slice_mesh(mesh, [1, 1, 1], N)
        self.assertEqual(N, len(slices))

        slices = merge_meshes(slices)
        self.assert_bbox_is_embedded(slices.bbox, mesh.bbox)
示例#3
0
    def test_diag_box(self):
        mesh = generate_box_mesh(
                np.array([0, 0, 0]), np.array([1, 1, 1]));
        N = 5;

        slices = slice_mesh(mesh, [1, 1, 1], N);
        self.assertEqual(N, len(slices));

        slices = merge_meshes(slices);
        self.assert_bbox_is_embedded(slices.bbox, mesh.bbox);
示例#4
0
def mesh_contours_pymesh(mesh, levels=None, density=100):
    vertices, faces = mesh.to_vertices_and_faces()
    m = pymesh.form_mesh(vertices, faces)
    return pymesh.slice_mesh(m, [0, 0, 1], 50)
示例#5
0
def slice(the_mesh, step=1.0, epsilon=0.001):
    n = math.ceil((the_mesh.bbox[1][2] - the_mesh.bbox[0][2]) / step)
    print("slicing into %d slices" % (n))
    return [[Contour(component) for component in pymesh.separate_mesh(slice)]
            for slice in pymesh.slice_mesh(the_mesh, numpy.array([0, 0, 1]), n)
            ]