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:
Diffstat (limited to 'xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp')
-rw-r--r--xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp b/xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp
index 08b095087..6bd7bf99f 100644
--- a/xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp
+++ b/xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp
@@ -46,10 +46,25 @@ std::string ShapeLike::toString(const PolygonImpl& sh)
return ss.str();
}
-template<> PolygonImpl ShapeLike::create( std::initializer_list< PointImpl > il)
+template<> PolygonImpl ShapeLike::create( const PathImpl& path )
{
PolygonImpl p;
- p.Contour = il;
+ p.Contour = path;
+
+ // Expecting that the coordinate system Y axis is positive in upwards
+ // direction
+ if(ClipperLib::Orientation(p.Contour)) {
+ // Not clockwise then reverse the b*tch
+ ClipperLib::ReversePath(p.Contour);
+ }
+
+ return p;
+}
+
+template<> PolygonImpl ShapeLike::create( PathImpl&& path )
+{
+ PolygonImpl p;
+ p.Contour.swap(path);
// Expecting that the coordinate system Y axis is positive in upwards
// direction