diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2019-07-17 14:32:31 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2019-07-17 14:32:31 +0300 |
commit | 2728f411238049668938e5529e36fc03c81eb203 (patch) | |
tree | 386c26a1d9829d8a2280b462765a656333cc78fc /src/libnest2d | |
parent | 44801f442932dfc3c61c5bbe6aa2eff597e448b5 (diff) |
Solved issue with virtual bed management.
libnest2d: Fix for unclosed polygons after merge.
Diffstat (limited to 'src/libnest2d')
-rw-r--r-- | src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp b/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp index c51e0f5c9..2ca4f5d50 100644 --- a/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp +++ b/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp @@ -259,10 +259,12 @@ inline TMultiShape<PolygonImpl> clipper_execute( poly.Contour.swap(pptr->Contour); assert(!pptr->IsHole()); - - if(pptr->IsOpen()) { + + if(!poly.Contour.empty() ) { auto front_p = poly.Contour.front(); - poly.Contour.emplace_back(front_p); + auto &back_p = poly.Contour.back(); + if(front_p.X != back_p.X || front_p.Y != back_p.X) + poly.Contour.emplace_back(front_p); } for(auto h : pptr->Childs) { processHole(h, poly); } @@ -274,10 +276,12 @@ inline TMultiShape<PolygonImpl> clipper_execute( poly.Holes.emplace_back(std::move(pptr->Contour)); assert(pptr->IsHole()); - - if(pptr->IsOpen()) { - auto front_p = poly.Holes.back().front(); - poly.Holes.back().emplace_back(front_p); + + if(!poly.Contour.empty() ) { + auto front_p = poly.Contour.front(); + auto &back_p = poly.Contour.back(); + if(front_p.X != back_p.X || front_p.Y != back_p.X) + poly.Contour.emplace_back(front_p); } for(auto c : pptr->Childs) processPoly(c); |