Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/slice.t
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2013-05-18 18:48:26 +0400
committerAlessandro Ranellucci <aar@cpan.org>2013-05-18 18:48:26 +0400
commit08a0bbd7f09ef9f2f48572ba75e878567ad90690 (patch)
tree31edc2db6b56c05c2980ddfc67722364d57db96d /t/slice.t
parente33ca54943c4579ac950f8e06561ac544e20f3b7 (diff)
Optimization: split meshes automatically when avoid_crossing_perimeters is enabled, so that we reduce the complexity of the MotionPlanner graphs. This commit includes a very large refactoring of the Model class which is now responsible for duplication and arrangement
Diffstat (limited to 't/slice.t')
-rw-r--r--t/slice.t20
1 files changed, 10 insertions, 10 deletions
diff --git a/t/slice.t b/t/slice.t
index cfa78a60c..e47929f0f 100644
--- a/t/slice.t
+++ b/t/slice.t
@@ -16,8 +16,6 @@ my @lines;
my $z = 20;
my @points = ([3, 4], [8, 5], [1, 9]); # XY coordinates of the facet vertices
-my $mesh = Slic3r::TriangleMesh->new(facets => [], vertices => []);
-
# NOTE:
# the first point of the intersection lines is replaced by -1 because TriangleMesh.pm
# is saving memory and doesn't store point A anymore since it's not actually needed.
@@ -104,19 +102,21 @@ my @upper = intersect(20, 20, 10);
is $lower[0][Slic3r::TriangleMesh::I_FACET_EDGE], Slic3r::TriangleMesh::FE_BOTTOM, 'bottom edge on layer';
is $upper[0][Slic3r::TriangleMesh::I_FACET_EDGE], Slic3r::TriangleMesh::FE_TOP, 'upper edge on layer';
-sub vertices {
- push @{$mesh->vertices}, map [ @{$points[$_]}, $_[$_] ], 0..2;
- [ ($#{$mesh->vertices}-2) .. $#{$mesh->vertices} ]
-}
+my $mesh;
-sub add_facet {
+sub intersect {
+ $mesh = Slic3r::TriangleMesh->new(
+ facets => [],
+ vertices => [],
+ );
push @{$mesh->facets}, [ [0,0,0], @{vertices(@_)} ];
$mesh->analyze;
+ return map Slic3r::TriangleMesh::unpack_line($_), $mesh->intersect_facet($#{$mesh->facets}, $z);
}
-sub intersect {
- add_facet(@_);
- return map Slic3r::TriangleMesh::unpack_line($_), $mesh->intersect_facet($#{$mesh->facets}, $z);
+sub vertices {
+ push @{$mesh->vertices}, map [ @{$points[$_]}, $_[$_] ], 0..2;
+ [ ($#{$mesh->vertices}-2) .. $#{$mesh->vertices} ]
}
sub lines {