mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 15:10:42 +08:00
Center mesh around origin for POV export
This commit is contained in:
parent
7ddf2b4029
commit
76f8e35502
@ -50,6 +50,7 @@ bool
|
||||
POV::write(TriangleMesh& mesh, std::string output_file)
|
||||
{
|
||||
TriangleMesh mesh2 = mesh;
|
||||
mesh2.center_around_origin();
|
||||
{
|
||||
Sizef3 size = mesh2.bounding_box().size();
|
||||
coordf_t maxdim = fmax(size.x, fmax(size.y, size.y));
|
||||
|
@ -262,6 +262,16 @@ void TriangleMesh::align_to_origin()
|
||||
);
|
||||
}
|
||||
|
||||
void TriangleMesh::center_around_origin()
|
||||
{
|
||||
this->align_to_origin();
|
||||
this->translate(
|
||||
-(this->stl.stats.size.x/2),
|
||||
-(this->stl.stats.size.y/2),
|
||||
-(this->stl.stats.size.z/2)
|
||||
);
|
||||
}
|
||||
|
||||
void TriangleMesh::rotate(double angle, Point* center)
|
||||
{
|
||||
this->translate(-center->x, -center->y, 0);
|
||||
|
@ -41,6 +41,7 @@ class TriangleMesh
|
||||
void mirror_y();
|
||||
void mirror_z();
|
||||
void align_to_origin();
|
||||
void center_around_origin();
|
||||
void rotate(double angle, Point* center);
|
||||
TriangleMeshPtrs split() const;
|
||||
void merge(const TriangleMesh &mesh);
|
||||
|
Loading…
x
Reference in New Issue
Block a user