diff options
Diffstat (limited to 'xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp')
-rw-r--r-- | xs/src/libnest2d/libnest2d/clipper_backend/clipper_backend.cpp | 19 |
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 |