mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 07:06:03 +08:00
change tests according to new class
This commit is contained in:
parent
89ed376553
commit
83c98871ba
@ -164,8 +164,16 @@ sub mesh {
|
||||
my $mesh = Slic3r::TriangleMesh->new;
|
||||
$mesh->ReadFromPerl($vertices, $facets);
|
||||
$mesh->repair;
|
||||
$mesh->scale_xyz(Slic3r::Pointf3->new(@{$params{scale_xyz}})) if $params{scale_xyz};
|
||||
$mesh->translate(@{$params{translate}}) if $params{translate};
|
||||
|
||||
my $trafo = Slic3r::TransformationMatrix->new;
|
||||
$trafo->set_scale_xyz(@{$params{scale_xyz}}) if $params{scale_xyz};
|
||||
if ($params{translate}) {
|
||||
my $trafo2 = Slic3r::TransformationMatrix->new;
|
||||
$trafo2->set_translation_xyz(@{$params{translate}});
|
||||
$trafo->applyLeft($trafo2);
|
||||
}
|
||||
|
||||
$mesh->transform($trafo);
|
||||
return $mesh;
|
||||
}
|
||||
|
||||
|
14
t/loops.t
14
t/loops.t
@ -23,17 +23,21 @@ use Slic3r::Test;
|
||||
|
||||
# center around origin
|
||||
my $bb = $mesh1->bounding_box;
|
||||
$mesh1->translate(
|
||||
|
||||
my $trafo = Slic3r::TransformationMatrix->new;
|
||||
$trafo->set_translation_xyz(
|
||||
-($bb->x_min + $bb->size->x/2),
|
||||
-($bb->y_min + $bb->size->y/2), #//
|
||||
-($bb->z_min + $bb->size->z/2),
|
||||
);
|
||||
|
||||
my $mesh2 = $mesh1->clone;
|
||||
$mesh2->scale(1.2);
|
||||
$mesh1->transform($trafo);
|
||||
|
||||
my $mesh3 = $mesh2->clone;
|
||||
$mesh3->scale(1.2);
|
||||
$trafo->set_scale_uni(1.2);
|
||||
|
||||
my $mesh2 = $mesh1->get_transformed_mesh($trafo);
|
||||
|
||||
my $mesh3 = $mesh2->get_transformed_mesh($trafo);
|
||||
|
||||
$mesh1->reverse_normals;
|
||||
ok $mesh1->volume < 0, 'reverse_normals';
|
||||
|
Loading…
x
Reference in New Issue
Block a user