diff --git a/xs/src/libslic3r/IO.cpp b/xs/src/libslic3r/IO.cpp index dddff3e22c..60c1ff686b 100644 --- a/xs/src/libslic3r/IO.cpp +++ b/xs/src/libslic3r/IO.cpp @@ -49,11 +49,18 @@ OBJ::write(TriangleMesh& mesh, std::string output_file) bool POV::write(TriangleMesh& mesh, std::string output_file) { + TriangleMesh mesh2 = mesh; + { + Sizef3 size = mesh2.bounding_box().size(); + coordf_t maxdim = fmax(size.x, fmax(size.y, size.y)); + mesh2.scale(10.0/maxdim); + } + using namespace std; ofstream pov; pov.open(output_file.c_str(), ios::out | ios::trunc); - for (int i = 0; i < mesh.stl.stats.number_of_facets; ++i) { - const stl_facet &f = mesh.stl.facet_start[i]; + for (int i = 0; i < mesh2.stl.stats.number_of_facets; ++i) { + const stl_facet &f = mesh2.stl.facet_start[i]; pov << "triangle { "; pov << "<" << f.vertex[0].x << "," << f.vertex[0].y << "," << f.vertex[0].z << ">,"; pov << "<" << f.vertex[1].x << "," << f.vertex[1].y << "," << f.vertex[1].z << ">,";