Skip to content

Commit

Permalink
Ported PrintObject::_simplify_slices() to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Nov 26, 2018
1 parent 725d0ab commit ea186f5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
12 changes: 0 additions & 12 deletions lib/Slic3r/Print/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,4 @@ sub combine_infill {
}
}

# Simplify the sliced model, if "resolution" configuration parameter > 0.
# The simplification is problematic, because it simplifies the slices independent from each other,
# which makes the simplified discretization visible on the object surface.
sub _simplify_slices {
my ($self, $distance) = @_;

foreach my $layer (@{$self->layers}) {
$layer->slices->simplify($distance);
$_->slices->simplify($distance) for @{$layer->regions};
}
}

1;
2 changes: 2 additions & 0 deletions xs/src/libslic3r/Print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ class PrintObject
/// Idempotence of this method is guaranteed by the fact that we don't remove things from
/// fill_surfaces but we only turn them into VOID surfaces, thus preserving the boundaries.
void clip_fill_surfaces();

void _simplify_slices(double distance);

private:
Print* _print;
Expand Down
13 changes: 13 additions & 0 deletions xs/src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,4 +1635,17 @@ PrintObject::clip_fill_surfaces()
}
}

// Simplify the sliced model, if "resolution" configuration parameter > 0.
// The simplification is problematic, because it simplifies the slices independent from each other,
// which makes the simplified discretization visible on the object surface.
void
PrintObject::_simplify_slices(double distance)
{
for (auto* layer : this->layers) {
layer->slices.simplify(distance);
for (auto* layerm : layer->regions)
layerm->slices.simplify(distance);
}
}

}
1 change: 1 addition & 0 deletions xs/xsp/Print.xsp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ _constant()
%};
void _make_perimeters();
void _infill();
void _simplify_slices(double distance);

int ptr()
%code%{ RETVAL = (int)(intptr_t)THIS; %};
Expand Down

0 comments on commit ea186f5

Please sign in to comment.