fix curve_smoothing return value.

This commit is contained in:
supermerill 2020-04-17 19:25:41 +02:00
parent a6b055b484
commit a6c011fbef

View File

@ -2537,31 +2537,28 @@ Polygon _smooth_curve(Polygon &p, double max_angle, double min_angle_convex, dou
} }
ExPolygons PrintObject::_smooth_curves(const ExPolygons & input, const PrintRegionConfig &conf) const { ExPolygons PrintObject::_smooth_curves(const ExPolygons & input, const PrintRegionConfig &conf) const {
ExPolygons new_polys;
if (conf.curve_smoothing_precision.value > 0.f) { for (const ExPolygon &ex_poly : input) {
ExPolygons new_polys; ExPolygon new_ex_poly(ex_poly);
for (const ExPolygon &ex_poly : input) { new_ex_poly.contour.remove_collinear(SCALED_RESOLUTION);
ExPolygon new_ex_poly(ex_poly); new_ex_poly.contour = _smooth_curve(new_ex_poly.contour, PI,
new_ex_poly.contour.remove_collinear(SCALED_RESOLUTION); conf.curve_smoothing_angle_convex.value*PI / 180.0,
new_ex_poly.contour = _smooth_curve(new_ex_poly.contour, PI, conf.curve_smoothing_angle_concave.value*PI / 180.0,
scale_(conf.curve_smoothing_cutoff_dist.value),
scale_(conf.curve_smoothing_precision.value));
for (Polygon &phole : new_ex_poly.holes){
phole.reverse(); // make_counter_clockwise();
phole.remove_collinear(SCALED_RESOLUTION);
phole = _smooth_curve(phole, PI,
conf.curve_smoothing_angle_convex.value*PI / 180.0, conf.curve_smoothing_angle_convex.value*PI / 180.0,
conf.curve_smoothing_angle_concave.value*PI / 180.0, conf.curve_smoothing_angle_concave.value*PI / 180.0,
scale_(conf.curve_smoothing_cutoff_dist.value), scale_(conf.curve_smoothing_cutoff_dist.value),
scale_(conf.curve_smoothing_precision.value)); scale_(conf.curve_smoothing_precision.value));
for (Polygon &phole : new_ex_poly.holes){ phole.reverse(); // make_clockwise();
phole.reverse(); // make_counter_clockwise(); }
phole.remove_collinear(SCALED_RESOLUTION); new_polys.push_back(new_ex_poly);
phole = _smooth_curve(phole, PI,
conf.curve_smoothing_angle_convex.value*PI / 180.0,
conf.curve_smoothing_angle_concave.value*PI / 180.0,
scale_(conf.curve_smoothing_cutoff_dist.value),
scale_(conf.curve_smoothing_precision.value));
phole.reverse(); // make_clockwise();
}
new_polys.push_back(new_ex_poly);
}
return new_polys;
} }
return new_polys;
} }
// To be used only if there are no layer span specific configurations applied, which would lead to z ranges being generated for this region. // To be used only if there are no layer span specific configurations applied, which would lead to z ranges being generated for this region.