improve smooth_curve (using remove_colinear)

This commit is contained in:
supermerill 2020-03-18 01:31:31 +01:00
parent 94ecbf39af
commit 5cc2fb72c9

View File

@ -2473,6 +2473,7 @@ ExPolygons PrintObject::_smooth_curves(const ExPolygons & input, const PrintRegi
ExPolygons new_polys;
for (const ExPolygon &ex_poly : input) {
ExPolygon new_ex_poly(ex_poly);
new_ex_poly.contour.remove_collinear(SCALED_RESOLUTION);
new_ex_poly.contour = _smooth_curve(new_ex_poly.contour, PI,
conf.curve_smoothing_angle_convex.value*PI / 180.0,
conf.curve_smoothing_angle_concave.value*PI / 180.0,
@ -2480,13 +2481,14 @@ ExPolygons PrintObject::_smooth_curves(const ExPolygons & input, const PrintRegi
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_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;