mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 04:25:57 +08:00
Fix of some asserts in MM segmentation.
This commit is contained in:
parent
212bf21b2d
commit
b655677c95
@ -1475,7 +1475,8 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
|
|||||||
if (std::vector<Polygons> &top = top_raw[color_idx]; ! top.empty() && ! top[layer_idx].empty())
|
if (std::vector<Polygons> &top = top_raw[color_idx]; ! top.empty() && ! top[layer_idx].empty())
|
||||||
if (ExPolygons top_ex = union_ex(top[layer_idx]); ! top_ex.empty()) {
|
if (ExPolygons top_ex = union_ex(top[layer_idx]); ! top_ex.empty()) {
|
||||||
// Clean up thin projections. They are not printable anyways.
|
// Clean up thin projections. They are not printable anyways.
|
||||||
top_ex = opening_ex(top_ex, stat.small_region_threshold);
|
if (stat.small_region_threshold > 0)
|
||||||
|
top_ex = opening_ex(top_ex, stat.small_region_threshold);
|
||||||
if (! top_ex.empty()) {
|
if (! top_ex.empty()) {
|
||||||
append(triangles_by_color_top[color_idx][layer_idx + layer_idx_offset], top_ex);
|
append(triangles_by_color_top[color_idx][layer_idx + layer_idx_offset], top_ex);
|
||||||
float offset = 0.f;
|
float offset = 0.f;
|
||||||
@ -1483,7 +1484,9 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
|
|||||||
for (int last_idx = int(layer_idx) - 1; last_idx >= std::max(int(layer_idx - stat.top_solid_layers), int(0)); --last_idx) {
|
for (int last_idx = int(layer_idx) - 1; last_idx >= std::max(int(layer_idx - stat.top_solid_layers), int(0)); --last_idx) {
|
||||||
offset -= stat.extrusion_width;
|
offset -= stat.extrusion_width;
|
||||||
layer_slices_trimmed = intersection_ex(layer_slices_trimmed, input_expolygons[last_idx]);
|
layer_slices_trimmed = intersection_ex(layer_slices_trimmed, input_expolygons[last_idx]);
|
||||||
ExPolygons last = opening_ex(intersection_ex(top_ex, offset_ex(layer_slices_trimmed, offset)), stat.small_region_threshold);
|
ExPolygons last = intersection_ex(top_ex, offset_ex(layer_slices_trimmed, offset));
|
||||||
|
if (stat.small_region_threshold > 0)
|
||||||
|
last = opening_ex(last, stat.small_region_threshold);
|
||||||
if (last.empty())
|
if (last.empty())
|
||||||
break;
|
break;
|
||||||
append(triangles_by_color_top[color_idx][last_idx + layer_idx_offset], std::move(last));
|
append(triangles_by_color_top[color_idx][last_idx + layer_idx_offset], std::move(last));
|
||||||
@ -1493,7 +1496,8 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
|
|||||||
if (std::vector<Polygons> &bottom = bottom_raw[color_idx]; ! bottom.empty() && ! bottom[layer_idx].empty())
|
if (std::vector<Polygons> &bottom = bottom_raw[color_idx]; ! bottom.empty() && ! bottom[layer_idx].empty())
|
||||||
if (ExPolygons bottom_ex = union_ex(bottom[layer_idx]); ! bottom_ex.empty()) {
|
if (ExPolygons bottom_ex = union_ex(bottom[layer_idx]); ! bottom_ex.empty()) {
|
||||||
// Clean up thin projections. They are not printable anyways.
|
// Clean up thin projections. They are not printable anyways.
|
||||||
bottom_ex = opening_ex(bottom_ex, stat.small_region_threshold);
|
if (stat.small_region_threshold > 0)
|
||||||
|
bottom_ex = opening_ex(bottom_ex, stat.small_region_threshold);
|
||||||
if (! bottom_ex.empty()) {
|
if (! bottom_ex.empty()) {
|
||||||
append(triangles_by_color_bottom[color_idx][layer_idx + layer_idx_offset], bottom_ex);
|
append(triangles_by_color_bottom[color_idx][layer_idx + layer_idx_offset], bottom_ex);
|
||||||
float offset = 0.f;
|
float offset = 0.f;
|
||||||
@ -1501,7 +1505,9 @@ static inline std::vector<std::vector<ExPolygons>> mmu_segmentation_top_and_bott
|
|||||||
for (size_t last_idx = layer_idx + 1; last_idx < std::min(layer_idx + stat.bottom_solid_layers, num_layers); ++last_idx) {
|
for (size_t last_idx = layer_idx + 1; last_idx < std::min(layer_idx + stat.bottom_solid_layers, num_layers); ++last_idx) {
|
||||||
offset -= stat.extrusion_width;
|
offset -= stat.extrusion_width;
|
||||||
layer_slices_trimmed = intersection_ex(layer_slices_trimmed, input_expolygons[last_idx]);
|
layer_slices_trimmed = intersection_ex(layer_slices_trimmed, input_expolygons[last_idx]);
|
||||||
ExPolygons last = opening_ex(intersection_ex(bottom_ex, offset_ex(layer_slices_trimmed, offset)), stat.small_region_threshold);
|
ExPolygons last = intersection_ex(bottom_ex, offset_ex(layer_slices_trimmed, offset));
|
||||||
|
if (stat.small_region_threshold > 0)
|
||||||
|
last = opening_ex(last, stat.small_region_threshold);
|
||||||
if (last.empty())
|
if (last.empty())
|
||||||
break;
|
break;
|
||||||
append(triangles_by_color_bottom[color_idx][last_idx + layer_idx_offset], std::move(last));
|
append(triangles_by_color_bottom[color_idx][last_idx + layer_idx_offset], std::move(last));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user