Fix fuzzy skin regresion classic wall generator (#12920)

Co-authored-by: Ian Bassi <12130714+ianalexis@users.noreply.github.com>
This commit is contained in:
Rodrigo Faselli
2026-04-06 15:29:23 -03:00
committed by GitHub
parent 7bec6c2d6b
commit d27889eb0f

View File

@@ -285,7 +285,7 @@ Polygon apply_fuzzy_skin(const Polygon& polygon, const PerimeterGenerator& perim
// Split the loops into lines with different config, and fuzzy them separately
fuzzified = polygon;
for (const auto& r : fuzzified_regions) {
const auto splitted = Algorithm::split_line(fuzzified, r.second, true);
auto splitted = Algorithm::split_line(fuzzified, r.second, true);
if (splitted.empty()) {
// No intersection, skip
continue;
@@ -296,26 +296,24 @@ Polygon apply_fuzzy_skin(const Polygon& polygon, const PerimeterGenerator& perim
// The entire polygon is fuzzified
fuzzy_polyline(fuzzified.points, true, slice_z, r.first);
} else {
// Start from a non-clipped junction so wrapped clipped segments do
// not need an artificial reconnection across the seam.
const auto first_non_clipped = std::find_if(splitted.begin(), splitted.end(), [](const Algorithm::SplitLineJunction& j) {
return !j.clipped;
});
if (first_non_clipped != splitted.begin()) {
std::rotate(splitted.begin(), first_non_clipped, splitted.end());
}
Points segment;
segment.reserve(splitted.size());
fuzzified.points.clear();
const auto fuzzy_current_segment = [&segment, &fuzzified, &r, slice_z]() {
// Orca: non fuzzy points to isolate fuzzy region
const auto front = segment.front();
const auto back = segment.back();
fuzzified.points.push_back(segment.front());
const auto back = segment.back();
fuzzy_polyline(segment, false, slice_z, r.first);
//Orca: only add non fuzzy point if it's not in the polygon closing point.
if (!fuzzified.points.empty()
&& fuzzified.points.back() != front) {
fuzzified.points.push_back(front);
}
fuzzified.points.insert(fuzzified.points.end(), segment.begin(), segment.end());
//Orca: only add non fuzzy point if it's not in the polygon closing point.
if (!fuzzified.points.empty() && fuzzified.points.back() != front) {
fuzzified.points.push_back(back);
}
fuzzified.points.push_back(back);
segment.clear();
};
@@ -338,12 +336,7 @@ Polygon apply_fuzzy_skin(const Polygon& polygon, const PerimeterGenerator& perim
}
}
}
// Orca: ensure the loop is closed after fuzzification
if (!fuzzified.points.empty() && fuzzified.points.front() != fuzzified.points.back()) {
fuzzified.points.back() = fuzzified.points.front();
}
return fuzzified;
}