mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-03 20:13:59 -06:00
Fixed MMU segmentation for multi-volume objects.
MMU segmentation no longer works directly on lslices, instead of it works on custom merged regions. So lslices in PrintObject are no longer overwritten because of MMU segmentation. All regions are scaled by SCALED_EPSILON before merging and shrunk back by SCALED_EPSILON after merging. That fixed issues with multi-volume objects when very close regions weren't merged. Also, small expolygons and holes are filtered out that fixed missing segmentation at the boundary of two volumes in the case of multi-volume objects.
This commit is contained in:
parent
0a8a3f6d8c
commit
168b4afbc2
4 changed files with 42 additions and 17 deletions
|
@ -372,6 +372,27 @@ bool remove_sticks(ExPolygon &poly)
|
|||
return remove_sticks(poly.contour) || remove_sticks(poly.holes);
|
||||
}
|
||||
|
||||
bool remove_small_and_small_holes(ExPolygons &expolygons, double min_area)
|
||||
{
|
||||
bool modified = false;
|
||||
size_t free_idx = 0;
|
||||
for (size_t expoly_idx = 0; expoly_idx < expolygons.size(); ++expoly_idx) {
|
||||
if (std::abs(expolygons[expoly_idx].area()) >= min_area) {
|
||||
// Expolygon is big enough, so also check all its holes
|
||||
modified |= remove_small(expolygons[expoly_idx].holes, min_area);
|
||||
if (free_idx < expoly_idx) {
|
||||
std::swap(expolygons[expoly_idx].contour, expolygons[free_idx].contour);
|
||||
std::swap(expolygons[expoly_idx].holes, expolygons[free_idx].holes);
|
||||
}
|
||||
++free_idx;
|
||||
} else
|
||||
modified = true;
|
||||
}
|
||||
if (free_idx < expolygons.size())
|
||||
expolygons.erase(expolygons.begin() + free_idx, expolygons.end());
|
||||
return modified;
|
||||
}
|
||||
|
||||
void keep_largest_contour_only(ExPolygons &polygons)
|
||||
{
|
||||
if (polygons.size() > 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue