Keep edge lines in rectilinear infill even when the sides are not perfectly straight

This commit is contained in:
Alessandro Ranellucci 2013-07-29 13:36:22 +02:00
parent 99963775ff
commit 80676f358a
3 changed files with 26 additions and 7 deletions

View file

@ -84,6 +84,12 @@ sub wkt {
join ',', map "($_)", map { join ',', map "$_->[0] $_->[1]", @$_ } @$self;
}
sub dump_perl {
my $self = shift;
return sprintf "[%s]",
join ',', map "[$_]", map { join ',', map "[$_->[0],$_->[1]]", @$_ } @$self;
}
sub offset {
my $self = shift;
return Slic3r::Geometry::Clipper::offset($self, @_);

View file

@ -55,8 +55,11 @@ sub fill_surface {
# clip paths against a slightly offsetted expolygon, so that the first and last paths
# are kept even if the expolygon has vertical sides
# the minimum offset for preventing edge lines from being clipped is scaled_epsilon;
# however we use a larger offset to support expolygons with slightly skewed sides and
# not perfectly straight
my @paths = @{ Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection(
[ $expolygon->offset_ex(scaled_epsilon) ],
[ $expolygon->offset_ex($line_spacing*0.05) ],
[ @vertical_lines ],
) };