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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2016-11-02 12:47:00 +0300
committerbubnikv <bubnikv@gmail.com>2016-11-02 12:47:00 +0300
commit95ede7c4b8cc40fe0fcf1960f25dfa9c66843b29 (patch)
tree609d320018e09d27f4b945915572d0fdf6e8c906 /t
parent3a31d37d3574093565ed4fc8baa7f90428d9324e (diff)
Rewrote Fill2.pm to C++, deleted Perl infills for good.
Removed dependency on Perl Math::PlanePath module. Fixed compilation with Visual Studio and SLIC3R_DEBUG: Visual Studio older than 2015 does not support the prinf type specifier %zu. Use %Iu instead. C++11 move semantics enabled.
Diffstat (limited to 't')
-rw-r--r--t/fill.t62
1 files changed, 25 insertions, 37 deletions
diff --git a/t/fill.t b/t/fill.t
index 6fb05196e..ba80406c0 100644
--- a/t/fill.t
+++ b/t/fill.t
@@ -19,26 +19,10 @@ use Slic3r::Test;
sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
{
- my $print = Slic3r::Print->new;
- my $filler = Slic3r::Fill::Rectilinear->new(
- print => $print,
- bounding_box => Slic3r::Geometry::BoundingBox->new_from_points([ Slic3r::Point->new(0, 0), Slic3r::Point->new(10, 10) ]),
- );
- my $surface_width = 250;
- my $distance = $filler->adjust_solid_spacing(
- width => $surface_width,
- distance => 100,
- );
- is $distance, 125, 'adjusted solid distance';
- is $surface_width % $distance, 0, 'adjusted solid distance';
-}
-
-{
my $expolygon = Slic3r::ExPolygon->new([ scale_points [0,0], [50,0], [50,50], [0,50] ]);
- my $filler = Slic3r::Fill::Rectilinear->new(
- bounding_box => $expolygon->bounding_box,
- angle => 0,
- );
+ my $filler = Slic3r::Filler->new_from_type('rectilinear');
+ $filler->set_bounding_box($expolygon->bounding_box);
+ $filler->set_angle(0);
my $surface = Slic3r::Surface->new(
surface_type => S_TYPE_TOP,
expolygon => $expolygon,
@@ -48,11 +32,11 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
height => 0.4,
nozzle_diameter => 0.50,
);
- $filler->spacing($flow->spacing);
+ $filler->set_spacing($flow->spacing);
foreach my $angle (0, 45) {
$surface->expolygon->rotate(Slic3r::Geometry::deg2rad($angle), [0,0]);
- my @paths = $filler->fill_surface($surface, layer_height => 0.4, density => 0.4);
- is scalar @paths, 1, 'one continuous path';
+ my $paths = $filler->fill_surface($surface, layer_height => 0.4, density => 0.4);
+ is scalar @$paths, 1, 'one continuous path';
}
}
@@ -60,10 +44,12 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
my $test = sub {
my ($expolygon, $flow_spacing, $angle, $density) = @_;
- my $filler = Slic3r::Fill::Rectilinear->new(
- bounding_box => $expolygon->bounding_box,
- angle => $angle // 0,
- );
+ my $filler = Slic3r::Filler->new_from_type('rectilinear');
+ $filler->set_bounding_box($expolygon->bounding_box);
+ $filler->set_angle($angle // 0);
+ # Adjust line spacing to fill the region.
+ $filler->set_dont_adjust(0);
+ $filler->set_link_max_length(scale(1.2*$flow_spacing));
my $surface = Slic3r::Surface->new(
surface_type => S_TYPE_BOTTOM,
expolygon => $expolygon,
@@ -73,28 +59,30 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
height => 0.4,
nozzle_diameter => $flow_spacing,
);
- $filler->spacing($flow->spacing);
- my @paths = $filler->fill_surface(
+ $filler->set_spacing($flow->spacing);
+ my $paths = $filler->fill_surface(
$surface,
layer_height => $flow->height,
density => $density // 1,
);
# check whether any part was left uncovered
- my @grown_paths = map @{Slic3r::Polyline->new(@$_)->grow(scale $filler->spacing/2)}, @paths;
+ my @grown_paths = map @{Slic3r::Polyline->new(@$_)->grow(scale $filler->spacing/2)}, @$paths;
my $uncovered = diff_ex([ @$expolygon ], [ @grown_paths ], 1);
# ignore very small dots
- @$uncovered = grep $_->area > (scale $flow_spacing)**2, @$uncovered;
-
- is scalar(@$uncovered), 0, 'solid surface is fully filled';
+ my $uncovered_filtered = [ grep $_->area > (scale $flow_spacing)**2, @$uncovered ];
+
+ is scalar(@$uncovered_filtered), 0, 'solid surface is fully filled';
- if (0 && @$uncovered) {
+ if (0 && @$uncovered_filtered) {
require "Slic3r/SVG.pm";
- Slic3r::SVG::output(
- "uncovered.svg",
- expolygons => [$expolygon],
- red_expolygons => $uncovered,
+ Slic3r::SVG::output("uncovered.svg",
+ no_arrows => 1,
+ expolygons => [ $expolygon ],
+ blue_expolygons => [ @$uncovered ],
+ red_expolygons => [ @$uncovered_filtered ],
+ polylines => [ @$paths ],
);
exit;
}