mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-17 06:35:56 +08:00
improve smooth_curve (using remove_colinear)
This commit is contained in:
parent
94ecbf39af
commit
5cc2fb72c9
@ -2473,6 +2473,7 @@ ExPolygons PrintObject::_smooth_curves(const ExPolygons & input, const PrintRegi
|
|||||||
ExPolygons new_polys;
|
ExPolygons new_polys;
|
||||||
for (const ExPolygon &ex_poly : input) {
|
for (const ExPolygon &ex_poly : input) {
|
||||||
ExPolygon new_ex_poly(ex_poly);
|
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,
|
new_ex_poly.contour = _smooth_curve(new_ex_poly.contour, 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,
|
||||||
@ -2480,13 +2481,14 @@ ExPolygons PrintObject::_smooth_curves(const ExPolygons & input, const PrintRegi
|
|||||||
scale_(conf.curve_smoothing_precision.value));
|
scale_(conf.curve_smoothing_precision.value));
|
||||||
for (Polygon &phole : new_ex_poly.holes){
|
for (Polygon &phole : new_ex_poly.holes){
|
||||||
phole.reverse(); // make_counter_clockwise();
|
phole.reverse(); // make_counter_clockwise();
|
||||||
|
phole.remove_collinear(SCALED_RESOLUTION);
|
||||||
phole = _smooth_curve(phole, PI,
|
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));
|
||||||
phole.reverse(); // make_clockwise();
|
phole.reverse(); // make_clockwise();
|
||||||
}
|
}
|
||||||
new_polys.push_back(new_ex_poly);
|
new_polys.push_back(new_ex_poly);
|
||||||
}
|
}
|
||||||
return new_polys;
|
return new_polys;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user