mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 10:47:50 -06:00
Added a new Slic3r::Geometry::simplify_polygons() function
This commit is contained in:
parent
d4ba0f17bb
commit
e2b1b52679
5 changed files with 36 additions and 4 deletions
|
@ -129,14 +129,20 @@ ExPolygon::simplify_p(double tolerance) const
|
|||
pp.reserve(this->holes.size() + 1);
|
||||
|
||||
// contour
|
||||
Polygon p = this->contour;
|
||||
p.points = MultiPoint::_douglas_peucker(p.points, tolerance);
|
||||
pp.push_back(p);
|
||||
{
|
||||
Polygon p = this->contour;
|
||||
p.points.push_back(p.points.front());
|
||||
p.points = MultiPoint::_douglas_peucker(p.points, tolerance);
|
||||
p.points.pop_back();
|
||||
pp.push_back(p);
|
||||
}
|
||||
|
||||
// holes
|
||||
for (Polygons::const_iterator it = this->holes.begin(); it != this->holes.end(); ++it) {
|
||||
p = *it;
|
||||
Polygon p = *it;
|
||||
p.points.push_back(p.points.front());
|
||||
p.points = MultiPoint::_douglas_peucker(p.points, tolerance);
|
||||
p.points.pop_back();
|
||||
pp.push_back(p);
|
||||
}
|
||||
simplify_polygons(pp, &pp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue