diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2013-05-18 18:48:26 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2013-05-18 18:48:26 +0400 |
commit | 08a0bbd7f09ef9f2f48572ba75e878567ad90690 (patch) | |
tree | 31edc2db6b56c05c2980ddfc67722364d57db96d /t/slice.t | |
parent | e33ca54943c4579ac950f8e06561ac544e20f3b7 (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.t | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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 { |