fix gapfill bits on outer edge of curves

medial_axis fusion_corners fix
using supermerill/SuperSlicer#1583 project to reproduce
This commit is contained in:
supermerill 2021-09-26 23:37:30 +02:00
parent 3f796cdf78
commit f138405bba

View File

@ -644,7 +644,6 @@ MedialAxis::fusion_corners(ThickPolylines &pp)
//if (polyline.points.size() != 2) continue; // maybe we should have something to merge X-point to 2-point if it's near enough.
if (polyline.endpoints.first) polyline.reverse();
else if (!polyline.endpoints.second) continue;
if (polyline.width.back() > 0) continue;
//check my length is small
coord_t length = (coord_t)polyline.length();
@ -676,6 +675,7 @@ MedialAxis::fusion_corners(ThickPolylines &pp)
if (pp[crosspoint[0]].endpoints.second && length > pp[crosspoint[0]].length()) continue;
if (pp[crosspoint[1]].endpoints.second && length > pp[crosspoint[1]].length()) continue;
if (polyline.width.back() > 0) {
//FIXME: also pull (a bit less) points that are near to this one.
// if true, pull it a bit, depends on my size, the dot?, and the coeff at my 0-end (~14% for a square, almost 0 for a gentle curve)
coord_t length_pull = (coord_t)polyline.length();
@ -698,6 +698,7 @@ MedialAxis::fusion_corners(ThickPolylines &pp)
Point& p2 = pp[crosspoint[1]].points[0];
p2.x() = p2.x() + (coord_t)pull_direction.x();
p2.y() = p2.y() + (coord_t)pull_direction.y();
}
//delete the now unused polyline
pp.erase(pp.begin() + i);