mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -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
|
@ -1,4 +1,5 @@
|
|||
#include "Geometry.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "ExPolygon.hpp"
|
||||
#include "Line.hpp"
|
||||
#include "PolylineCollection.hpp"
|
||||
|
@ -146,6 +147,20 @@ deg2rad(double angle)
|
|||
return PI * angle / 180.0;
|
||||
}
|
||||
|
||||
void
|
||||
simplify_polygons(const Polygons &polygons, double tolerance, Polygons* retval)
|
||||
{
|
||||
Polygons pp;
|
||||
for (Polygons::const_iterator it = polygons.begin(); it != polygons.end(); ++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);
|
||||
}
|
||||
Slic3r::simplify_polygons(pp, retval);
|
||||
}
|
||||
|
||||
Line
|
||||
MedialAxis::edge_to_line(const VD::edge_type &edge) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue