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

@ -3965,7 +3965,7 @@ static void project_triangles_to_slabs(ConstLayerPtrsAdaptor layers, const index
}
void PrintObject::project_and_append_custom_facets(
bool seam, EnforcerBlockerType type, std::vector<Polygons>& out) const
bool seam, EnforcerBlockerType type, std::vector<Polygons>& out, std::vector<std::pair<Vec3f, Vec3f>>* vertical_points) const
{
for (const ModelVolume* mv : this->model_object()->volumes)
if (mv->is_model_part()) {
@ -3980,7 +3980,7 @@ void PrintObject::project_and_append_custom_facets(
else {
std::vector<Polygons> projected;
// Support blockers or enforcers. Project downward facing painted areas upwards to their respective slicing plane.
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, [](){});
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, vertical_points, [](){});
// Merge these projections with the output, layer by layer.
assert(! projected.empty());
assert(out.empty() || out.size() == projected.size());