ENH: add vertical support enforcer

Previously painting support enforces on vertical faces doesn't work, as projecting the facets downwards will give empty polygons.
Now we use a different mechanism to enable vertical paint-on enforces, by directly adding contact nodes.
Note: this feature only works with tree support as only tree support has contact nodes.

jira: none
Change-Id: Id171b1665566d142a6427285baccb40c0aa00949
(cherry picked from commit 9c882f61eb37350a4486df58de48f0ae489f2d15)
(cherry picked from commit 68625a6e601e2feef8e56693da1f58372b27b560)
This commit is contained in:
Arthur 2024-03-21 16:43:45 +08:00 committed by Noisyfox
parent 5054ee8508
commit ae6fadda4d
8 changed files with 70 additions and 17 deletions

View file

@ -3400,6 +3400,22 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons
append(overhangs[i + num_raft_layers], polys);
}
}
// add vertical enforcer points
std::vector<float> zs = zs_from_layers(print_object.layers());
Polygon base_circle = make_circle(scale_(0.5), SUPPORT_TREE_CIRCLE_RESOLUTION);
for (auto &pt_and_normal :tree_support->m_vertical_enforcer_points) {
auto pt = pt_and_normal.first;
auto normal = pt_and_normal.second; // normal seems useless
auto iter = std::lower_bound(zs.begin(), zs.end(), pt.z());
if (iter != zs.end()) {
size_t layer_nr = iter - zs.begin();
if (layer_nr > 0 && layer_nr < print_object.layer_count()) {
Polygon circle = base_circle;
circle.translate(to_2d(pt).cast<coord_t>());
overhangs[layer_nr + num_raft_layers].emplace_back(std::move(circle));
}
}
}
#else
std::vector<Polygons> overhangs = generate_overhangs(config, *print.get_object(processing.second.front()), throw_on_cancel);
#endif