mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-09 14:55:08 -06:00
More unfinished work
This commit is contained in:
parent
518798beb3
commit
df8d889481
16 changed files with 74 additions and 48 deletions
|
@ -44,23 +44,6 @@ sub bounding_box {
|
|||
return $self->contour->bounding_box;
|
||||
}
|
||||
|
||||
sub simplify_as_polygons {
|
||||
my $self = shift;
|
||||
my ($tolerance) = @_;
|
||||
|
||||
# it would be nice to have a multilinestring_simplify method in B::G::U
|
||||
return @{Slic3r::Geometry::Clipper::simplify_polygons(
|
||||
[ map Boost::Geometry::Utils::linestring_simplify($_, $tolerance), @{$self->pp} ],
|
||||
)};
|
||||
}
|
||||
|
||||
sub simplify {
|
||||
my $self = shift;
|
||||
my ($tolerance) = @_;
|
||||
|
||||
return @{ Slic3r::Geometry::Clipper::union_ex([ $self->simplify_as_polygons($tolerance) ]) };
|
||||
}
|
||||
|
||||
# this method only works for expolygons having only a contour or
|
||||
# a contour and a hole, and not being thicker than the supplied
|
||||
# width. it returns a polyline or a polygon
|
||||
|
@ -205,6 +188,7 @@ sub _medial_axis_voronoi {
|
|||
}
|
||||
|
||||
my @result = ();
|
||||
my $simplify_tolerance = $width / 7;
|
||||
foreach my $polyline (@polylines) {
|
||||
next unless @$polyline >= 2;
|
||||
|
||||
|
@ -213,11 +197,11 @@ sub _medial_axis_voronoi {
|
|||
|
||||
if ($points[0]->coincides_with($points[-1])) {
|
||||
next if @points == 2;
|
||||
push @result, Slic3r::Polygon->new(@points[0..$#points-1]);
|
||||
push @result, @{Slic3r::Polygon->new(@points[0..$#points-1])->simplify($simplify_tolerance)};
|
||||
} else {
|
||||
push @result, Slic3r::Polyline->new(@points);
|
||||
$result[-1]->simplify($simplify_tolerance);
|
||||
}
|
||||
$result[-1]->simplify($width / 7);
|
||||
}
|
||||
|
||||
return @result;
|
||||
|
|
|
@ -38,7 +38,7 @@ sub BUILD {
|
|||
my $crossing_edges = $self->_crossing_edges;
|
||||
|
||||
# simplify islands
|
||||
$_->simplify($self->_inner_margin) for @{$self->islands};
|
||||
@{$self->islands} = map @{$_->simplify($self->_inner_margin)}, @{$self->islands};
|
||||
|
||||
# process individual islands
|
||||
for my $i (0 .. $#{$self->islands}) {
|
||||
|
|
|
@ -217,7 +217,7 @@ sub make_perimeters {
|
|||
# non-collapsing regions
|
||||
$self->fill_surfaces->append(
|
||||
@{offset2_ex(
|
||||
[ map $_->simplify_as_polygons(&Slic3r::SCALED_RESOLUTION), @{union_ex(\@last)} ],
|
||||
[ map @{$_->simplify_p(&Slic3r::SCALED_RESOLUTION)}, @{union_ex(\@last)} ],
|
||||
-($pspacing/2 + $ispacing/2),
|
||||
+$ispacing/2,
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue