Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2015-01-30 20:33:20 +0300
committerAlessandro Ranellucci <aar@cpan.org>2015-01-30 20:33:20 +0300
commite2b1b526792e2c2525521c9d28ccb77c0d26fbdd (patch)
treee089f2bc3c5cc894b662de27dfcbd30d0607c410 /xs/src/libslic3r/Geometry.cpp
parentd4ba0f17bbaeff180f25252c512add240650b9a1 (diff)
Added a new Slic3r::Geometry::simplify_polygons() function
Diffstat (limited to 'xs/src/libslic3r/Geometry.cpp')
-rw-r--r--xs/src/libslic3r/Geometry.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/xs/src/libslic3r/Geometry.cpp b/xs/src/libslic3r/Geometry.cpp
index 8169da5a3..3dc11c0cb 100644
--- a/xs/src/libslic3r/Geometry.cpp
+++ b/xs/src/libslic3r/Geometry.cpp
@@ -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
{