mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 06:31:59 +08:00
Bugfix: missing infill segments in some rare circumstances
This commit is contained in:
parent
48910a7970
commit
1843e377d3
19
t/fill.t
19
t/fill.t
@ -2,7 +2,7 @@ use Test::More;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
plan tests => 93;
|
||||
plan tests => 95;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
@ -86,6 +86,23 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
|
||||
'paths don\'t cross hole') or done_testing, exit;
|
||||
}
|
||||
}
|
||||
|
||||
# rotated square
|
||||
$filler->set_angle(PI/4);
|
||||
$filler->set_dont_adjust(0);
|
||||
$filler->set_min_spacing(0.654498);
|
||||
$filler->set_endpoints_overlap(unscale(359974));
|
||||
$filler->set_density(1);
|
||||
$filler->set_layer_id(66);
|
||||
$filler->set_z(20.15);
|
||||
{
|
||||
my $e = Slic3r::ExPolygon->new(
|
||||
Slic3r::Polygon->new([25771516,14142125],[14142138,25771515],[2512749,14142131],[14142125,2512749]),
|
||||
);
|
||||
my $paths = $test->($e);
|
||||
is(scalar @$paths, 1, 'one continuous path') or done_testing, exit;
|
||||
ok abs($paths->[0]->length - scale(3*100 + 2*50)) - scaled_epsilon, 'path has expected length';
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -37,9 +37,14 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon,
|
||||
if (bounding_box.size().x < min_spacing) return;
|
||||
|
||||
// Due to integer rounding, rotated polygons might not preserve verticality
|
||||
// (i.e. when rotating by PI/2 two points having the same x coordinate
|
||||
// they might get different y coordinates), thus the first line will be skipped.
|
||||
bounding_box.offset(-1);
|
||||
// (i.e. when rotating by PI/2 two points having the same y coordinate
|
||||
// they might get different x coordinates), thus the first line will be skipped.
|
||||
// Reducing by 1 is not enough, as we observed normal squares being off by about 30
|
||||
// units along x between points supposed to be vertically aligned (coming from an
|
||||
// axis-aligned polygon edge). We need to be very tolerant here, especially when
|
||||
// making solid infill where lack of lines is visible.
|
||||
bounding_box.min.x += SCALED_EPSILON;
|
||||
bounding_box.max.x -= SCALED_EPSILON;
|
||||
|
||||
// define flow spacing according to requested density
|
||||
if (this->density > 0.9999f && !this->dont_adjust) {
|
||||
|
@ -246,6 +246,12 @@ LayerRegion::make_fill()
|
||||
// apply half spacing using this flow's own spacing and generate infill
|
||||
f->density = density/100;
|
||||
f->dont_adjust = false;
|
||||
/*
|
||||
std::cout << surface.expolygon.dump_perl() << std::endl
|
||||
<< " layer_id: " << f->layer_id << " z: " << f->z
|
||||
<< " angle: " << f->angle << " min-spacing: " << f->min_spacing
|
||||
<< " endpoints_overlap: " << f->endpoints_overlap << std::endl << std::endl;
|
||||
*/
|
||||
Polylines polylines = f->fill_surface(surface);
|
||||
if (polylines.empty())
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user