Skip to content

Commit

Permalink
bugfix ensure_not_overextrude
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Dec 18, 2018
1 parent 767fc86 commit 44e7ec8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions xs/src/libslic3r/MedialAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ MedialAxis::fusion_corners(ThickPolylines &pp)

void
MedialAxis::extends_line_both_side(ThickPolylines& pp) {
const ExPolygons anchors = offset2_ex(diff_ex(this->bounds, this->expolygon), -SCALED_RESOLUTION, SCALED_RESOLUTION);
const ExPolygons anchors = offset2_ex(to_polygons(diff_ex(this->bounds, this->expolygon)), -SCALED_RESOLUTION, SCALED_RESOLUTION);
for (size_t i = 0; i < pp.size(); ++i) {
ThickPolyline& polyline = pp[i];
this->extends_line(polyline, anchors, this->min_width);
Expand Down Expand Up @@ -1257,17 +1257,16 @@ MedialAxis::ensure_not_overextrude(ThickPolylines& pp)
// add holes "perimeter gaps"
double holesGaps = 0;
for (const Polygon &hole : bounds.holes) {
holesGaps += hole->length() * height * (1 - 0.25*PI) * 0.5;
holesGaps += hole.length() * height * (1 - 0.25*PI) * 0.5;
}
boundsVolume += perimeterRoundGap + holesGaps;

if (boundsVolume < volume) {
//reduce width
double reduce_by = boundsVolume / volume;
for (ThickPolyline& polyline : pp) {
for (ThickLine &l : polyline.thicklines()) {
l.a_width *= reduce_by;
l.b_width *= reduce_by;
for (coordf_t &width : polyline.width) {
width *= reduce_by;
}
}
}
Expand Down

0 comments on commit 44e7ec8

Please sign in to comment.