mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 16:52:02 +08:00
Auto-scale POV output
This commit is contained in:
parent
0b79b971e8
commit
7ddf2b4029
@ -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 << ">,";
|
||||
|
Loading…
x
Reference in New Issue
Block a user