Fix tests
This commit is contained in:
parent
a1a33c2291
commit
0ffb0f6a58
5 changed files with 15 additions and 7 deletions
|
@ -209,6 +209,7 @@ sub medial_axis {
|
|||
|
||||
# cleanup
|
||||
$polyline = Slic3r::Geometry::douglas_peucker($polyline, $width / 7);
|
||||
$polyline = Slic3r::Polyline->new(@$polyline);
|
||||
|
||||
if (Slic3r::Geometry::same_point($polyline->first_point, $polyline->last_point)) {
|
||||
next if @$polyline == 2;
|
||||
|
|
|
@ -100,8 +100,9 @@ sub change_layer {
|
|||
$self->_upper_layer_islands([]);
|
||||
}
|
||||
$self->_layer_overhangs(
|
||||
# clone ExPolygons because they come from Surface objects but will be used outside here
|
||||
$layer->id > 0 && ($layer->config->overhangs || $Slic3r::Config->start_perimeters_at_non_overhang)
|
||||
? [ map $_->expolygon, grep $_->surface_type == S_TYPE_BOTTOM, map @{$_->slices}, @{$layer->regions} ]
|
||||
? [ map $_->expolygon->clone, grep $_->surface_type == S_TYPE_BOTTOM, map @{$_->slices}, @{$layer->regions} ]
|
||||
: []
|
||||
);
|
||||
if ($self->config->avoid_crossing_perimeters) {
|
||||
|
@ -228,7 +229,9 @@ sub extrude_loop {
|
|||
$extrusion_path->intersect_expolygons($self->_layer_overhangs);
|
||||
|
||||
# reapply the nearest point search for starting point
|
||||
@paths = @{Slic3r::ExtrusionPath::Collection->new(@paths)->chained_path_from($start_at, 1)};
|
||||
# (clone because the collection gets DESTROY'ed)
|
||||
my $collection = Slic3r::ExtrusionPath::Collection->new(@paths);
|
||||
@paths = map $_->clone, @{$collection->chained_path_from($start_at, 1)};
|
||||
} else {
|
||||
push @paths, $extrusion_path;
|
||||
}
|
||||
|
@ -353,7 +356,7 @@ sub extrude_path {
|
|||
}
|
||||
}
|
||||
$gcode .= ";_BRIDGE_FAN_END\n" if $path->is_bridge;
|
||||
$self->last_pos($path->last_point);
|
||||
$self->last_pos($path->last_point->clone);
|
||||
|
||||
if ($self->config->cooling) {
|
||||
my $path_time = $path_length / $F * 60;
|
||||
|
|
|
@ -46,6 +46,7 @@ sub output {
|
|||
$arrows = 0;
|
||||
} elsif ($type =~ /^(?:(.+?)_)?expolygons$/) {
|
||||
my $colour = $1;
|
||||
@$value = map $_->pp, @$value;
|
||||
|
||||
my $g = $svg->group(
|
||||
style => {
|
||||
|
@ -63,6 +64,7 @@ sub output {
|
|||
}
|
||||
} elsif ($type =~ /^(?:(.+?)_)?(polygon|polyline)s$/) {
|
||||
my ($colour, $method) = ($1, $2);
|
||||
@$value = map $_->pp, @$value;
|
||||
|
||||
my $g = $svg->group(
|
||||
style => {
|
||||
|
@ -83,8 +85,9 @@ sub output {
|
|||
);
|
||||
}
|
||||
} elsif ($type =~ /^(?:(.+?)_)?points$/) {
|
||||
my $colour = $1;
|
||||
my $colour = $1 // 'black';
|
||||
my $r = $colour eq 'black' ? 5 : 3;
|
||||
@$value = map $_->pp, @$value;
|
||||
|
||||
my $g = $svg->group(
|
||||
style => {
|
||||
|
@ -102,6 +105,7 @@ sub output {
|
|||
}
|
||||
} elsif ($type =~ /^(?:(.+?)_)?lines$/) {
|
||||
my $colour = $1;
|
||||
@$value = map $_->pp, @$value;
|
||||
|
||||
my $g = $svg->group(
|
||||
style => {
|
||||
|
|
4
t/fill.t
4
t/fill.t
|
@ -115,7 +115,7 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
|
|||
Slic3r::Polyline->new([0,10], [0,8], [0,5]),
|
||||
);
|
||||
is_deeply
|
||||
[ map $_->[Y], map @$_, @{$collection->chained_path(Slic3r::Point->new(0,30), 0)} ],
|
||||
[ map $_->[Y], map @$_, @{$collection->chained_path_from(Slic3r::Point->new(0,30), 0)} ],
|
||||
[20, 18, 15, 10, 8, 5],
|
||||
'chained path';
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
|
|||
Slic3r::Polyline->new([10,5], [15,5], [20,5]),
|
||||
);
|
||||
is_deeply
|
||||
[ map $_->[X], map @$_, @{$collection->chained_path(Slic3r::Point->new(30,0), 0)} ],
|
||||
[ map $_->[X], map @$_, @{$collection->chained_path_from(Slic3r::Point->new(30,0), 0)} ],
|
||||
[reverse 4, 10, 15, 10, 15, 20],
|
||||
'chained path';
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ use Slic3r::Test;
|
|||
push @$cur_loop, [ @$info{qw(new_X new_Y)} ];
|
||||
} else {
|
||||
if ($cur_loop) {
|
||||
$has_cw_loops = 1 if Slic3r::Polygon->new(@$cur_loop)->is_clockwise;
|
||||
$has_cw_loops = 1 if Slic3r::Polygon->new_scale(@$cur_loop)->is_clockwise;
|
||||
if ($self->F == $config->external_perimeter_speed*60) {
|
||||
my $move_dest = Slic3r::Point->new_scale(@$info{qw(new_X new_Y)});
|
||||
$external_loops{$self->Z}++;
|
||||
|
|
Loading…
Reference in a new issue