mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
Code cleanup and remove arc compensation code
This commit is contained in:
parent
5efa409c7c
commit
d2425748a3
1 changed files with 15 additions and 39 deletions
|
@ -171,33 +171,9 @@ sub make_perimeters {
|
||||||
my @holes = (); # array of Polygons with cw orientation
|
my @holes = (); # array of Polygons with cw orientation
|
||||||
my @gaps = (); # array of ExPolygons
|
my @gaps = (); # array of ExPolygons
|
||||||
|
|
||||||
# for each island:
|
# we need to process each island separately because we might have different
|
||||||
|
# extra perimeters for each one
|
||||||
foreach my $surface (@{$self->slices}) {
|
foreach my $surface (@{$self->slices}) {
|
||||||
|
|
||||||
# experimental hole compensation (see ArcCompensation in the RepRap wiki)
|
|
||||||
if (0) {
|
|
||||||
my @last_offsets = (); # dumb instantiation
|
|
||||||
foreach my $hole ($last_offsets[0]->holes) {
|
|
||||||
my $circumference = abs($hole->length);
|
|
||||||
next unless $circumference <= &Slic3r::SMALL_PERIMETER_LENGTH;
|
|
||||||
# this compensation only works for circular holes, while it would
|
|
||||||
# overcompensate for hexagons and other shapes having straight edges.
|
|
||||||
# so we require a minimum number of vertices.
|
|
||||||
next unless $circumference / @$hole >= 3 * $self->perimeter_flow->scaled_width;
|
|
||||||
|
|
||||||
# revert the compensation done in make_surfaces() and get the actual radius
|
|
||||||
# of the hole
|
|
||||||
my $radius = ($circumference / PI / 2) - $self->perimeter_flow->scaled_spacing/2;
|
|
||||||
my $new_radius = ($self->perimeter_flow->scaled_width + sqrt(($self->perimeter_flow->scaled_width ** 2) + (4*($radius**2)))) / 2;
|
|
||||||
# holes are always turned to contours, so reverse point order before and after
|
|
||||||
$hole->reverse;
|
|
||||||
my @offsetted = $hole->offset(+ ($new_radius - $radius));
|
|
||||||
# skip arc compensation when hole is not round (thus leads to multiple offsets)
|
|
||||||
@$hole = map Slic3r::Point->new($_), @{ $offsetted[0] } if @offsetted == 1;
|
|
||||||
$hole->reverse;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# detect how many perimeters must be generated for this island
|
# detect how many perimeters must be generated for this island
|
||||||
my $loop_number = $Slic3r::Config->perimeters + ($surface->extra_perimeters || 0);
|
my $loop_number = $Slic3r::Config->perimeters + ($surface->extra_perimeters || 0);
|
||||||
|
|
||||||
|
@ -235,7 +211,6 @@ sub make_perimeters {
|
||||||
}
|
}
|
||||||
|
|
||||||
# create one more offset to be used as boundary for fill
|
# create one more offset to be used as boundary for fill
|
||||||
{
|
|
||||||
# we offset by half the perimeter spacing (to get to the actual infill boundary)
|
# we offset by half the perimeter spacing (to get to the actual infill boundary)
|
||||||
# and then we offset back and forth by the infill spacing to only consider the
|
# and then we offset back and forth by the infill spacing to only consider the
|
||||||
# non-collapsing regions
|
# non-collapsing regions
|
||||||
|
@ -247,7 +222,6 @@ sub make_perimeters {
|
||||||
+$infill_spacing,
|
+$infill_spacing,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$self->_fill_gaps(\@gaps);
|
$self->_fill_gaps(\@gaps);
|
||||||
|
|
||||||
|
@ -304,7 +278,9 @@ sub make_perimeters {
|
||||||
# TODO: add test for perimeter order
|
# TODO: add test for perimeter order
|
||||||
@loops = reverse @loops
|
@loops = reverse @loops
|
||||||
if $Slic3r::Config->external_perimeters_first
|
if $Slic3r::Config->external_perimeters_first
|
||||||
|| $self->layer->id == 0 && $Slic3r::Config->brim_width > 0;
|
|| ($self->layer->id == 0 && $Slic3r::Config->brim_width > 0);
|
||||||
|
|
||||||
|
# append perimeters
|
||||||
push @{ $self->perimeters }, @loops;
|
push @{ $self->perimeters }, @loops;
|
||||||
|
|
||||||
# add thin walls as perimeters
|
# add thin walls as perimeters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue