Pull build fixes from libnest2d and allow reverse order checks in DJD placement for better quality results.

This commit is contained in:
tamasmeszaros 2018-07-02 10:45:06 +02:00
parent 6ffdea1457
commit 86726b15b4
3 changed files with 10 additions and 9 deletions

View File

@ -143,7 +143,7 @@ inline void ShapeLike::offset(PolygonImpl& sh, TCoord<PointImpl> distance) {
using ClipperLib::Paths; using ClipperLib::Paths;
// If the input is not at least a triangle, we can not do this algorithm // If the input is not at least a triangle, we can not do this algorithm
if(sh.Contour.size() <= 3) throw GeometryException(GeoErr::OFFSET); if(sh.Contour.size() <= 3) throw GeometryException(GeomErr::OFFSET);
ClipperOffset offs; ClipperOffset offs;
Paths result; Paths result;
@ -154,7 +154,7 @@ inline void ShapeLike::offset(PolygonImpl& sh, TCoord<PointImpl> distance) {
// it removes the last vertex as well so boost will not have a closed // it removes the last vertex as well so boost will not have a closed
// polygon // polygon
if(result.size() != 1) throw GeometryException(GeoErr::OFFSET); if(result.size() != 1) throw GeometryException(GeomErr::OFFSET);
sh.Contour = result.front(); sh.Contour = result.front();

View File

@ -205,7 +205,7 @@ inline Radians::Radians(const Degrees &degs): Double( degs * Pi/180) {}
inline double Radians::toDegrees() { return operator Degrees(); } inline double Radians::toDegrees() { return operator Degrees(); }
enum class GeoErr : std::size_t { enum class GeomErr : std::size_t {
OFFSET, OFFSET,
MERGE, MERGE,
NFP NFP
@ -219,18 +219,18 @@ static const std::string ERROR_STR[] = {
class GeometryException: public std::exception { class GeometryException: public std::exception {
virtual const char * errorstr(GeoErr errcode) const { virtual const char * errorstr(GeomErr errcode) const BP2D_NOEXCEPT {
return ERROR_STR[static_cast<std::size_t>(errcode)].c_str(); return ERROR_STR[static_cast<std::size_t>(errcode)].c_str();
} }
GeoErr errcode_; GeomErr errcode_;
public: public:
GeometryException(GeoErr code): errcode_(code) {} GeometryException(GeomErr code): errcode_(code) {}
GeoErr errcode() const { return errcode_; } GeomErr errcode() const { return errcode_; }
virtual const char * what() const override { virtual const char * what() const BP2D_NOEXCEPT override {
return errorstr(errcode_); return errorstr(errcode_);
} }
}; };

View File

@ -467,7 +467,8 @@ bool arrange(Model &model, coordf_t dist, const Slic3r::BoundingBoxf* bb,
Arranger::PlacementConfig pcfg; Arranger::PlacementConfig pcfg;
Arranger::SelectionConfig scfg; Arranger::SelectionConfig scfg;
scfg.try_reverse_order = false; scfg.try_reverse_order = true;
scfg.allow_parallel = true;
scfg.force_parallel = true; scfg.force_parallel = true;
pcfg.alignment = Arranger::PlacementConfig::Alignment::CENTER; pcfg.alignment = Arranger::PlacementConfig::Alignment::CENTER;