mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 15:44:12 -06:00
Use poly2tri for triangulation. This fixes some cases where polyPartition couldn't triangulate successfully. Reported as issue #9 in polyPartition repository. Tested with MotorHalter_0.stl cut at 1.2
This commit is contained in:
parent
60f640f100
commit
edeb0a90dd
19 changed files with 2830 additions and 6 deletions
|
@ -467,6 +467,31 @@ void simplify_polygons(const Slic3r::Polygons &subject, Slic3r::Polygons &retval
|
|||
delete output;
|
||||
}
|
||||
|
||||
void simplify_polygons(const Slic3r::Polygons &subject, Slic3r::ExPolygons &retval, bool preserve_collinear)
|
||||
{
|
||||
if (!preserve_collinear) {
|
||||
Polygons polygons;
|
||||
simplify_polygons(subject, polygons, preserve_collinear);
|
||||
union_(polygons, retval);
|
||||
return;
|
||||
}
|
||||
|
||||
// convert into Clipper polygons
|
||||
ClipperLib::Paths input_subject;
|
||||
Slic3rMultiPoints_to_ClipperPaths(subject, input_subject);
|
||||
|
||||
ClipperLib::PolyTree polytree;
|
||||
|
||||
ClipperLib::Clipper c;
|
||||
c.PreserveCollinear(true);
|
||||
c.StrictlySimple(true);
|
||||
c.AddPaths(input_subject, ClipperLib::ptSubject, true);
|
||||
c.Execute(ClipperLib::ctUnion, polytree, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
|
||||
|
||||
// convert into ExPolygons
|
||||
PolyTreeToExPolygons(polytree, retval);
|
||||
}
|
||||
|
||||
void safety_offset(ClipperLib::Paths* &subject)
|
||||
{
|
||||
// scale input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue