Пример #1
0
def main():
    args = parse_args()
    mesh = pymesh.load_mesh(args.input_mesh)
    out_mesh, info = pymesh.split_long_edges(mesh, args.max_edge_length)

    if mesh.has_attribute("corner_texture"):
        pymesh.map_corner_attribute(mesh, out_mesh, "corner_texture")

    pymesh.save_mesh(args.output_mesh, out_mesh, *out_mesh.attribute_names)
Пример #2
0
def main():
    args = parse_args();
    mesh = pymesh.load_mesh(args.input_mesh);
    out_mesh, info = pymesh.split_long_edges(mesh, args.max_edge_length);

    if mesh.has_attribute("corner_texture"):
        pymesh.map_corner_attribute(mesh, out_mesh, "corner_texture");

    pymesh.save_mesh(args.output_mesh, out_mesh, *out_mesh.attribute_names);
Пример #3
0
    def test_map_corner_attribute_sphere(self):
        mesh1 = pymesh.generate_icosphere(2.0, [0.0, 0.0, 0.0], 2)
        mesh2 = pymesh.generate_icosphere(2.1, [0.0, 0.0, 0.0], 2)

        value = np.arange(mesh1.num_faces * mesh1.vertex_per_face)
        mesh1.add_attribute("test", dtype=np.int32)
        mesh1.set_attribute("test", value)

        pymesh.map_corner_attribute(mesh1, mesh2, "test")

        self.assertTrue(mesh2.has_attribute("test"))
        mapped_value = mesh2.get_attribute("test")

        diff = value - mapped_value
        largest_error = np.amax(np.absolute(diff))
        self.assertLess(largest_error, 1e-12)