mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 17:25:53 +08:00
Ported align_to_origin()
This commit is contained in:
parent
597e9e6c14
commit
9d50616c7d
@ -112,4 +112,13 @@ void TriangleMesh::translate(float x, float y, float z)
|
|||||||
stl_translate(&(this->stl), x, y, z);
|
stl_translate(&(this->stl), x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TriangleMesh::align_to_origin()
|
||||||
|
{
|
||||||
|
this->translate(
|
||||||
|
-(this->stl.stats.min.x),
|
||||||
|
-(this->stl.stats.min.y),
|
||||||
|
-(this->stl.stats.min.z)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ class TriangleMesh
|
|||||||
void WriteOBJFile(char* output_file);
|
void WriteOBJFile(char* output_file);
|
||||||
void scale(float factor);
|
void scale(float factor);
|
||||||
void translate(float x, float y, float z);
|
void translate(float x, float y, float z);
|
||||||
|
void align_to_origin();
|
||||||
stl_file stl;
|
stl_file stl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Slic3r::XS;
|
use Slic3r::XS;
|
||||||
use Test::More tests => 7;
|
use Test::More tests => 8;
|
||||||
|
|
||||||
is Slic3r::TriangleMesh::XS::hello_world(), 'Hello world!',
|
is Slic3r::TriangleMesh::XS::hello_world(), 'Hello world!',
|
||||||
'hello world';
|
'hello world';
|
||||||
@ -34,6 +34,9 @@ my $cube = {
|
|||||||
|
|
||||||
$m->translate(5,10,0);
|
$m->translate(5,10,0);
|
||||||
is_deeply $m->vertices->[0], [45,50,0], 'translate';
|
is_deeply $m->vertices->[0], [45,50,0], 'translate';
|
||||||
|
|
||||||
|
$m->align_to_origin;
|
||||||
|
is_deeply $m->vertices->[2], [0,0,0], 'align_to_origin';
|
||||||
}
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
void WriteOBJFile(char* output_file);
|
void WriteOBJFile(char* output_file);
|
||||||
void scale(float factor);
|
void scale(float factor);
|
||||||
void translate(float x, float y, float z);
|
void translate(float x, float y, float z);
|
||||||
|
void align_to_origin();
|
||||||
%{
|
%{
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user