diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2020-05-06 17:44:52 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2020-06-01 17:16:30 +0300 |
commit | 4be0e37963aeb03819402f93bc9d9106535c5772 (patch) | |
tree | 6a6612e705516b07bd2113ec88ce9c7da8355d8c /src/libnest2d | |
parent | 9146ef2f6140d183c18523b07368b6b7710e5a60 (diff) |
Workaround for items out of bed after arrange.
Fixes #4329
Diffstat (limited to 'src/libnest2d')
-rw-r--r-- | src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp | 6 | ||||
-rw-r--r-- | src/libnest2d/include/libnest2d/placers/nfpplacer.hpp | 15 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp b/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp index 57da6ec12..dd80322bc 100644 --- a/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp +++ b/src/libnest2d/include/libnest2d/backends/clipper/geometries.hpp @@ -77,7 +77,7 @@ inline void offset(PolygonImpl& sh, TCoord<PointImpl> distance, const PolygonTag #define DISABLE_BOOST_OFFSET using ClipperLib::ClipperOffset; - using ClipperLib::jtMiter; + using ClipperLib::jtSquare; using ClipperLib::etClosedPolygon; using ClipperLib::Paths; @@ -85,8 +85,8 @@ inline void offset(PolygonImpl& sh, TCoord<PointImpl> distance, const PolygonTag try { ClipperOffset offs; - offs.AddPath(sh.Contour, jtMiter, etClosedPolygon); - offs.AddPaths(sh.Holes, jtMiter, etClosedPolygon); + offs.AddPath(sh.Contour, jtSquare, etClosedPolygon); + offs.AddPaths(sh.Holes, jtSquare, etClosedPolygon); offs.Execute(result, static_cast<double>(distance)); } catch (ClipperLib::clipperException &) { throw GeometryException(GeomErr::OFFSET); diff --git a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index 91f04cb93..6cdaadd25 100644 --- a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -528,15 +528,12 @@ public: static inline double overfit(const Box& bb, const Box& bin) { - auto Bw = bin.width(); - auto Bh = bin.height(); - auto mBw = -Bw; - auto mBh = -Bh; - auto wdiff = double(bb.width()) + mBw; - auto hdiff = double(bb.height()) + mBh; - double diff = 0; - if(wdiff > 0) diff += wdiff; - if(hdiff > 0) diff += hdiff; + auto wdiff = TCompute<RawShape>(bb.width()) - bin.width(); + auto hdiff = TCompute<RawShape>(bb.height()) - bin.height(); + double diff = .0; + if(wdiff > 0) diff += double(wdiff); + if(hdiff > 0) diff += double(hdiff); + return diff; } |