ENH: tree support uses accurate lslices

For tree support, use lslices as tree support island when generating brim,
as this is faster and more accurate.
For normal support, still use "support_fills.polygons_covered_by_spacing()" as support island when generating brim;

Jira: studio 4332

Change-Id: Ibfadd3a166606f824e5780b57112fff221470aaf
(cherry picked from commit 64960b19818c7029eaaaf3d8a89804aeaa26f11d)
(cherry picked from commit 181b05c236)
This commit is contained in:
Arthur 2023-09-14 17:20:58 +08:00 committed by Noisyfox
parent cc9f29c463
commit b3be5bb161

View file

@ -1973,6 +1973,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
int interface_id = 0;
bool has_polygon_node = false;
bool has_circle_node = false;
bool need_extra_wall = false;
BOOST_LOG_TRIVIAL(debug) << "circles at layer " << layer_nr << " contact nodes size=" << contact_nodes[layer_nr].size();
//Draw the support areas and add the roofs appropriately to the support roof instead of normal areas.
@ -2039,7 +2040,6 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
}
append(area, overhang_expanded);
}
has_circle_node = true;
}
if (layer_nr>0 && node.distance_to_top < 0)
@ -2061,19 +2061,8 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
max_layers_above_base = std::max(max_layers_above_base, node.dist_mm_to_top);
}
if (layer_nr < brim_skirt_layers)
append(ts_layer->lslices, area);
}
ts_layer->lslices = std::move(union_ex(ts_layer->lslices));
//Must update bounding box which is used in avoid crossing perimeter
ts_layer->lslices_bboxes.clear();
ts_layer->lslices_bboxes.reserve(ts_layer->lslices.size());
for (const ExPolygon &expoly : ts_layer->lslices)
ts_layer->lslices_bboxes.emplace_back(get_extents(expoly));
ts_layer->backup_untyped_slices();
m_object->print()->set_status(65, (boost::format( _u8L("Support: generate polygons at layer %d")) % layer_nr).str());
// join roof segments
@ -2142,6 +2131,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
for (auto& area : ts_layer->base_areas) {
area_groups.emplace_back(&area, SupportLayer::BaseType, max_layers_above_base);
area_groups.back().need_infill = has_polygon_node;
// area_groups.back().need_extra_wall = need_extra_wall;
}
for (auto& area : ts_layer->roof_areas) {
area_groups.emplace_back(&area, SupportLayer::RoofType, max_layers_above_roof);
@ -2158,8 +2148,19 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
return bbox_size[0] < scale_(2) && bbox_size[1] < scale_(2);
}),
expoly->holes.end());
if (layer_nr < brim_skirt_layers)
ts_layer->lslices.emplace_back(*expoly);
}
ts_layer->lslices = std::move(union_ex(ts_layer->lslices));
//Must update bounding box which is used in avoid crossing perimeter
ts_layer->lslices_bboxes.clear();
ts_layer->lslices_bboxes.reserve(ts_layer->lslices.size());
for (const ExPolygon& expoly : ts_layer->lslices)
ts_layer->lslices_bboxes.emplace_back(get_extents(expoly));
ts_layer->backup_untyped_slices();
}
});