mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Initial port of the new ensure vertical thickness algorithm from PrusaSlicer (#2382)
* Initial port of the new ensure vertical thickness algorithm from PrusaSlicer. Based on prusa3d/PrusaSlicer@1a0d8f5130 * Remove code related to "Detect narrow internal solid infill" as it's handled by the new ensuring code * Support different internal solid infill pattern * Ignore removed options --------- Co-authored-by: Pavel Mikuš <pavel.mikus.mail@seznam.cz> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -4103,19 +4103,40 @@ void AddPolyNodeToPaths(const PolyNode& polynode, NodeType nodetype, Paths& path
|
||||
for (int i = 0; i < polynode.ChildCount(); ++i)
|
||||
AddPolyNodeToPaths(*polynode.Childs[i], nodetype, paths);
|
||||
}
|
||||
|
||||
void AddPolyNodeToPaths(PolyNode&& polynode, NodeType nodetype, Paths& paths)
|
||||
{
|
||||
bool match = true;
|
||||
if (nodetype == ntClosed) match = !polynode.IsOpen();
|
||||
else if (nodetype == ntOpen) return;
|
||||
|
||||
if (!polynode.Contour.empty() && match)
|
||||
paths.emplace_back(std::move(polynode.Contour));
|
||||
for (int i = 0; i < polynode.ChildCount(); ++i)
|
||||
AddPolyNodeToPaths(std::move(*polynode.Childs[i]), nodetype, paths);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths)
|
||||
{
|
||||
paths.resize(0);
|
||||
paths.clear();
|
||||
paths.reserve(polytree.Total());
|
||||
AddPolyNodeToPaths(polytree, ntAny, paths);
|
||||
}
|
||||
|
||||
void PolyTreeToPaths(PolyTree&& polytree, Paths& paths)
|
||||
{
|
||||
paths.clear();
|
||||
paths.reserve(polytree.Total());
|
||||
AddPolyNodeToPaths(std::move(polytree), ntAny, paths);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths)
|
||||
{
|
||||
paths.resize(0);
|
||||
paths.clear();
|
||||
paths.reserve(polytree.Total());
|
||||
AddPolyNodeToPaths(polytree, ntClosed, paths);
|
||||
}
|
||||
@@ -4123,7 +4144,7 @@ void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths)
|
||||
|
||||
void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths)
|
||||
{
|
||||
paths.resize(0);
|
||||
paths.clear();
|
||||
paths.reserve(polytree.Total());
|
||||
//Open paths are top level only, so ...
|
||||
for (int i = 0; i < polytree.ChildCount(); ++i)
|
||||
|
||||
@@ -204,6 +204,7 @@ void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool
|
||||
void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
|
||||
|
||||
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
|
||||
void PolyTreeToPaths(PolyTree&& polytree, Paths& paths);
|
||||
void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths);
|
||||
void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user