Revert "Remove thumbnail simplification because it caused loss of very thin parts. #1327"

This reverts commit 1210b89893.

Conflicts:

	lib/Slic3r/GUI/Plater.pm
xsdata-boost
Alessandro Ranellucci 2013-08-05 20:48:09 +02:00
parent 0ce7ebc4b8
commit 4438aec12c
2 changed files with 20 additions and 9 deletions

View File

@ -325,6 +325,11 @@ use Slic3r::Geometry qw(X1 Y1);
has 'expolygons' => (is => 'ro', default => sub { [] }); has 'expolygons' => (is => 'ro', default => sub { [] });
sub append {
my $self = shift;
push @{$self->expolygons}, @_;
}
sub clone { sub clone {
my $self = shift; my $self = shift;
return (ref $self)->new( return (ref $self)->new(

View File

@ -1167,17 +1167,23 @@ sub make_thumbnail {
my $self = shift; my $self = shift;
my $mesh = $self->model_object->mesh; # $self->model_object is already aligned to origin my $mesh = $self->model_object->mesh; # $self->model_object is already aligned to origin
my $thumbnail = Slic3r::ExPolygon::Collection->new( my $thumbnail = Slic3r::ExPolygon::Collection->new;
expolygons => (@{$mesh->facets} <= 5000) if (@{$mesh->facets} <= 5000) {
? $mesh->horizontal_projection $thumbnail->append(@{ $mesh->horizontal_projection });
: [ Slic3r::ExPolygon->new($self->convex_hull) ], } else {
); my $convex_hull = Slic3r::ExPolygon->new($self->convex_hull)->clone;
# Note: the call to simplify() was removed here because it used Clipper $convex_hull->scale(1/&Slic3r::SCALING_FACTOR);
# simplification which needs integerization. $thumbnail->append($convex_hull);
# TODO: remove polygons with area <= 1 pixel }
# remove polygons with area <= 1mm
my $area_threshold = Slic3r::Geometry::scale 1;
@{$thumbnail->expolygons} =
map $_->simplify(0.5),
grep $_->area >= $area_threshold,
@{$thumbnail->expolygons};
$thumbnail->scale(&Slic3r::SCALING_FACTOR); $thumbnail->scale(&Slic3r::SCALING_FACTOR);
$self->thumbnail($thumbnail); # ignored in multi-threaded environments $self->thumbnail($thumbnail); # ignored in multi-threaded environments
$self->free_model_object; $self->free_model_object;