mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-26 16:13:58 -06:00
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:
parent
5054ee8508
commit
ae6fadda4d
8 changed files with 70 additions and 17 deletions
|
@ -957,7 +957,6 @@ inline std::pair<SlabLines, SlabLines> slice_slabs_make_lines(
|
|||
}
|
||||
slice_facet_with_slabs<true>(vertices, indices, face_idx, neighbors, edge_ids, num_edges, zs, lines_top, lines_mutex_top);
|
||||
}
|
||||
// BBS: add vertical faces option
|
||||
if (bottom && (fo == FaceOrientation::Down || fo == FaceOrientation::Degenerate)) {
|
||||
Vec3i32 neighbors = face_neighbors[face_idx];
|
||||
// Reset neighborship of this triangle in case the other triangle is oriented backwards from this one.
|
||||
|
@ -2063,6 +2062,7 @@ void slice_mesh_slabs(
|
|||
const Transform3d &trafo,
|
||||
std::vector<Polygons> *out_top,
|
||||
std::vector<Polygons> *out_bottom,
|
||||
std::vector<std::pair<Vec3f, Vec3f>> *vertical_points,
|
||||
std::function<void()> throw_on_cancel)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << "slice_mesh_slabs to polygons";
|
||||
|
@ -2133,6 +2133,11 @@ void slice_mesh_slabs(
|
|||
// Is the triangle vertical or degenerate?
|
||||
assert(d == 0);
|
||||
fo = fa == fb || fa == fc || fb == fc ? FaceOrientation::Degenerate : FaceOrientation::Vertical;
|
||||
if(vertical_points && fo==FaceOrientation::Vertical)
|
||||
{
|
||||
Vec3f normal = (fb - fa).cross(fc - fa).normalized();
|
||||
vertical_points->push_back({ (fa + fb + fc) / 3,normal });
|
||||
}
|
||||
}
|
||||
face_orientation[&tri - mesh.indices.data()] = fo;
|
||||
}
|
||||
|
@ -2297,7 +2302,7 @@ void project_mesh(
|
|||
{
|
||||
std::vector<Polygons> top, bottom;
|
||||
std::vector<float> zs { -1e10, 1e10 };
|
||||
slice_mesh_slabs(mesh, zs, trafo, out_top ? &top : nullptr, out_bottom ? &bottom : nullptr, throw_on_cancel);
|
||||
slice_mesh_slabs(mesh, zs, trafo, out_top ? &top : nullptr, out_bottom ? &bottom : nullptr, nullptr, throw_on_cancel);
|
||||
if (out_top)
|
||||
*out_top = std::move(top.front());
|
||||
if (out_bottom)
|
||||
|
@ -2311,7 +2316,7 @@ Polygons project_mesh(
|
|||
{
|
||||
std::vector<Polygons> top, bottom;
|
||||
std::vector<float> zs { -1e10, 1e10 };
|
||||
slice_mesh_slabs(mesh, zs, trafo, &top, &bottom, throw_on_cancel);
|
||||
slice_mesh_slabs(mesh, zs, trafo, &top, &bottom, nullptr, throw_on_cancel);
|
||||
return union_(top.front(), bottom.back());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue