mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Fix fuzzy skin regresion classic wall generator (#12920)
Co-authored-by: Ian Bassi <12130714+ianalexis@users.noreply.github.com>
This commit is contained in:
@@ -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
|
// Split the loops into lines with different config, and fuzzy them separately
|
||||||
fuzzified = polygon;
|
fuzzified = polygon;
|
||||||
for (const auto& r : fuzzified_regions) {
|
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()) {
|
if (splitted.empty()) {
|
||||||
// No intersection, skip
|
// No intersection, skip
|
||||||
continue;
|
continue;
|
||||||
@@ -296,26 +296,24 @@ Polygon apply_fuzzy_skin(const Polygon& polygon, const PerimeterGenerator& perim
|
|||||||
// The entire polygon is fuzzified
|
// The entire polygon is fuzzified
|
||||||
fuzzy_polyline(fuzzified.points, true, slice_z, r.first);
|
fuzzy_polyline(fuzzified.points, true, slice_z, r.first);
|
||||||
} else {
|
} 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;
|
Points segment;
|
||||||
segment.reserve(splitted.size());
|
segment.reserve(splitted.size());
|
||||||
fuzzified.points.clear();
|
fuzzified.points.clear();
|
||||||
|
|
||||||
const auto fuzzy_current_segment = [&segment, &fuzzified, &r, slice_z]() {
|
const auto fuzzy_current_segment = [&segment, &fuzzified, &r, slice_z]() {
|
||||||
// Orca: non fuzzy points to isolate fuzzy region
|
fuzzified.points.push_back(segment.front());
|
||||||
const auto front = segment.front();
|
const auto back = segment.back();
|
||||||
const auto back = segment.back();
|
|
||||||
|
|
||||||
fuzzy_polyline(segment, false, slice_z, r.first);
|
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());
|
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.
|
fuzzified.points.push_back(back);
|
||||||
if (!fuzzified.points.empty() && fuzzified.points.back() != front) {
|
|
||||||
fuzzified.points.push_back(back);
|
|
||||||
}
|
|
||||||
segment.clear();
|
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;
|
return fuzzified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user