diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-10-10 00:18:06 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-10-10 00:18:06 +0400 |
commit | 84abd41cf454bcc9bccaa0c3921263d519106d97 (patch) | |
tree | 76a4f389ba15fa0aab363157fe374dd5e262e22b /lib/Slic3r/Layer.pm | |
parent | 459577f9a2ee4b6a751ba735cf23a023bcd68ce8 (diff) |
Fixes for bridges
Diffstat (limited to 'lib/Slic3r/Layer.pm')
-rw-r--r-- | lib/Slic3r/Layer.pm | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 3c250ca2c..267424f39 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -157,8 +157,21 @@ sub make_surfaces { my %seen_points = map { $get_point_id->($points[$_]) => $_ } 0..1; CYCLE: while (1) { - my $next_lines = $pointmap{ $get_point_id->($points[-1]) } - or die sprintf "No lines start at point %d,%d. This shouldn't happen", @{$points[-1]}; + my $next_lines = $pointmap{ $get_point_id->($points[-1]) }; + + # shouldn't we find the point, let's try with a slower algorithm + # as approximation may make the coordinates differ + if (!$next_lines) { + local $Slic3r::Geometry::epsilon = 1; + for (keys %pointmap) { + $next_lines = $pointmap{$_} if points_coincide($points[-1], [ split /,/, $_ ]); + last if $next_lines; + } + } + + $next_lines + or die sprintf "No lines start at point %s. This shouldn't happen", + $get_point_id->($points[-1]); last CYCLE if !@$next_lines; my @ordered_next_lines = sort @@ -256,6 +269,12 @@ sub process_bridges { # in a convex polygon; this will print thin membranes eventually my $surface_p = convex_hull($surface->contour->p); + #use Slic3r::SVG; + #Slic3r::SVG::output(undef, "bridge.svg", + # green_polygons => [ map $_->p, @supporting_surfaces ], + # red_polygons => [ $surface_p ], + #); + # find all supported edges (as polylines, thus keeping notion of # consecutive supported edges) my @supported_polylines = (); |