Added a new Slic3r::Geometry::simplify_polygons() function

This commit is contained in:
Alessandro Ranellucci 2015-01-30 18:33:20 +01:00
parent d4ba0f17bb
commit e2b1b52679
5 changed files with 36 additions and 4 deletions

View file

@ -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
{