mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 06:04:01 -06:00
Speed-up of painted seams
This commit is contained in:
parent
6f2e33dfb9
commit
b5fea72618
1 changed files with 19 additions and 17 deletions
|
@ -207,32 +207,34 @@ void SeamPlacer::init(const Print& print)
|
||||||
|
|
||||||
auto merge_and_offset = [po, &temp_polygons, max_nozzle_dmr](EnforcerBlockerType type, std::vector<ExPolygons>& out) {
|
auto merge_and_offset = [po, &temp_polygons, max_nozzle_dmr](EnforcerBlockerType type, std::vector<ExPolygons>& out) {
|
||||||
// Offset the triangles out slightly.
|
// Offset the triangles out slightly.
|
||||||
|
auto offset_out = [](Polygon& input, float offset) -> ExPolygons {
|
||||||
|
ClipperLib::Paths out(1);
|
||||||
|
std::vector<float> deltas(input.points.size(), offset);
|
||||||
|
input.make_counter_clockwise();
|
||||||
|
out.front() = mittered_offset_path_scaled(input.points, deltas, 3.);
|
||||||
|
return ClipperPaths_to_Slic3rExPolygons(out);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
temp_polygons.clear();
|
temp_polygons.clear();
|
||||||
po->project_and_append_custom_facets(true, type, temp_polygons);
|
po->project_and_append_custom_facets(true, type, temp_polygons);
|
||||||
out.clear();
|
out.clear();
|
||||||
out.reserve(temp_polygons.size());
|
out.reserve(temp_polygons.size());
|
||||||
float offset = max_nozzle_dmr + po->config().elefant_foot_compensation;
|
float offset = scale_(max_nozzle_dmr + po->config().elefant_foot_compensation);
|
||||||
for (const Polygons &src : temp_polygons) {
|
for (Polygons &src : temp_polygons) {
|
||||||
out.emplace_back(Slic3r::offset_ex(src, scale_(offset)));
|
out.emplace_back(ExPolygons());
|
||||||
offset = max_nozzle_dmr;
|
for (Polygon& plg : src) {
|
||||||
|
ExPolygons offset_explg = offset_out(plg, offset);
|
||||||
|
if (! offset_explg.empty())
|
||||||
|
out.back().emplace_back(std::move(offset_explg.front()));
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = scale_(max_nozzle_dmr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
merge_and_offset(EnforcerBlockerType::BLOCKER, temp_blk);
|
merge_and_offset(EnforcerBlockerType::BLOCKER, temp_blk);
|
||||||
merge_and_offset(EnforcerBlockerType::ENFORCER, temp_enf);
|
merge_and_offset(EnforcerBlockerType::ENFORCER, temp_enf);
|
||||||
|
|
||||||
// FIXME: Offsetting should be done somehow cheaper, but following does not work
|
|
||||||
// for (auto* custom_per_object : {&temp_enf, &temp_blk}) {
|
|
||||||
// for (ExPolygons& plgs : *custom_per_object) {
|
|
||||||
// for (ExPolygon& plg : plgs) {
|
|
||||||
// auto out = Slic3r::offset_ex(plg, scale_(max_nozzle_dmr));
|
|
||||||
// plg = out.empty() ? ExPolygon() : out.front();
|
|
||||||
// assert(out.empty() || out.size() == 1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Remember this PrintObject and initialize a store of enforcers and blockers for it.
|
// Remember this PrintObject and initialize a store of enforcers and blockers for it.
|
||||||
m_po_list.push_back(po);
|
m_po_list.push_back(po);
|
||||||
size_t po_idx = m_po_list.size() - 1;
|
size_t po_idx = m_po_list.size() - 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue