Bugfix: some bridges had wrong perimeters inside

This commit is contained in:
Alessandro Ranellucci 2011-10-13 22:22:45 +02:00
parent c97a89c07c
commit 56619871b2
3 changed files with 13 additions and 5 deletions

View File

@ -157,7 +157,7 @@ sub point_in_segment {
# if line is vertical, check whether point's X is the same as the line # if line is vertical, check whether point's X is the same as the line
if ($line->[A][X] == $line->[B][X]) { if ($line->[A][X] == $line->[B][X]) {
return 1 if abs($x - $line->[A][X]) < epsilon; return abs($x - $line->[A][X]) < epsilon ? 1 : 0;
} }
# calculate the Y in line at X of the point # calculate the Y in line at X of the point

View File

@ -281,6 +281,14 @@ sub process_bridges {
# in a convex polygon; this will print thin membranes eventually # in a convex polygon; this will print thin membranes eventually
my $surface_p = convex_hull($surface->contour->p); my $surface_p = convex_hull($surface->contour->p);
# offset the surface a bit to avoid approximation issues when doing the
# intersection below (this is to make sure we overlap with supporting
# surfaces, otherwise a little gap will result from intersection)
{
my $offset = offset([$surface_p], 100, 100, JT_MITER, 2);
$surface_p = $offset->[0];
}
#use Slic3r::SVG; #use Slic3r::SVG;
#Slic3r::SVG::output(undef, "bridge.svg", #Slic3r::SVG::output(undef, "bridge.svg",
# green_polygons => [ map $_->p, @supporting_surfaces ], # green_polygons => [ map $_->p, @supporting_surfaces ],

View File

@ -140,13 +140,13 @@ sub detect_surfaces_type {
# actually, this shouldn't happen so it deserves further investigation # actually, this shouldn't happen so it deserves further investigation
@bottom = grep $_->contour->is_valid, @bottom; @bottom = grep $_->contour->is_valid, @bottom;
for (@bottom) { foreach my $surface (@bottom) {
$_->contour->remove_acute_vertices; $surface->contour->remove_acute_vertices;
# okay, this is an Ugly Hack(tm) to avoid floating point math problems # okay, this is an Ugly Hack(tm) to avoid floating point math problems
# with diagonal bridges. will find a nicer solution, promised. # with diagonal bridges. will find a nicer solution, promised.
my $offset = offset([$_->contour->p], 100, 100, JT_MITER, 2); my $offset = offset([$surface->contour->p], 100, 100, JT_MITER, 2);
@{$_->contour->points} = map Slic3r::Point->new($_), @{ $offset->[0] }; @{$surface->contour->points} = map Slic3r::Point->new($_), @{ $offset->[0] };
} }
#Slic3r::SVG::output(undef, "layer_" . $layer->id . "_diff.svg", #Slic3r::SVG::output(undef, "layer_" . $layer->id . "_diff.svg",