diff --git a/lib/Slic3r/Geometry/Clipper.pm b/lib/Slic3r/Geometry/Clipper.pm index 609701e58..9e23b6c79 100644 --- a/lib/Slic3r/Geometry/Clipper.pm +++ b/lib/Slic3r/Geometry/Clipper.pm @@ -5,9 +5,9 @@ use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(offset offset_ex - diff_ex diff union_ex intersection_ex xor_ex JT_ROUND + diff_ex diff union_ex intersection_ex xor_ex JT_ROUND JT_MITER JT_SQUARE is_counter_clockwise union_pt offset2 offset2_ex traverse_pt - intersection union); + intersection union CLIPPER_OFFSET_SCALE); use Slic3r::Geometry qw(scale); diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 06c9d1b06..de3c2d87a 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -5,7 +5,7 @@ use List::Util qw(min max sum first); use Slic3r::ExtrusionPath ':roles'; use Slic3r::Geometry qw(X Y Z PI scale unscale deg2rad rad2deg scaled_epsilon chained_path_points); use Slic3r::Geometry::Clipper qw(diff diff_ex intersection intersection_ex union union_ex - offset offset_ex offset2); + offset offset_ex offset2 CLIPPER_OFFSET_SCALE JT_MITER); use Slic3r::Surface ':types'; has 'print' => (is => 'ro', weak_ref => 1, required => 1); @@ -628,10 +628,15 @@ sub discover_horizontal_shells { # make sure the new internal solid is wide enough, as it might get collapsed when # spacing is added in Fill.pm { + # we use a higher miterLimit here to handle areas with acute angles + # in those cases, the default miterLimit would cut the corner and we'd + # get a triangle in $too_narrow; if we grow it below then the shell + # would have a different shape from the external surface and we'd still + # have the same angle, so the next shell would be grown even more and so on. my $margin = 3 * $layerm->solid_infill_flow->scaled_width; # require at least this size my $too_narrow = diff_ex( [ map @$_, @$new_internal_solid ], - offset2([ map @$_, @$new_internal_solid ], -$margin, +$margin), + offset2([ map @$_, @$new_internal_solid ], -$margin, +$margin, CLIPPER_OFFSET_SCALE, JT_MITER, 5), 1, ); diff --git a/xs/xsp/Clipper.xsp b/xs/xsp/Clipper.xsp index 67d6d6b20..2e63afbb9 100644 --- a/xs/xsp/Clipper.xsp +++ b/xs/xsp/Clipper.xsp @@ -16,6 +16,7 @@ _constant() JT_MITER = jtMiter JT_ROUND = jtRound JT_SQUARE = jtSquare + CLIPPER_OFFSET_SCALE = CLIPPER_OFFSET_SCALE CODE: RETVAL = ix; OUTPUT: RETVAL