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;
// 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;
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
// polygon
if(result.size() != 1) throw GeometryException(GeoErr::OFFSET);
if(result.size() != 1) throw GeometryException(GeomErr::OFFSET);
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(); }
enum class GeoErr : std::size_t {
enum class GeomErr : std::size_t {
OFFSET,
MERGE,
NFP
@ -219,18 +219,18 @@ static const std::string ERROR_STR[] = {
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();
}
GeoErr errcode_;
GeomErr errcode_;
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_);
}
};

View File

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