From db05f00860f58d36f7c3a9a4bcba9eb581b5b55c Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 16 Nov 2020 13:11:58 +0100 Subject: [PATCH] Fixing compilation issues. --- src/libslic3r/ExPolygon.hpp | 12 ++++++------ src/libslic3r/Fill/Fill3DHoneycomb.cpp | 2 +- src/libslic3r/Fill/Fill3DHoneycomb.hpp | 2 +- src/libslic3r/Fill/FillAdaptive.cpp | 2 +- src/libslic3r/Fill/FillAdaptive.hpp | 2 +- src/libslic3r/Fill/FillBase.hpp | 2 +- src/libslic3r/Fill/FillConcentric.cpp | 2 +- src/libslic3r/Fill/FillConcentric.hpp | 2 +- src/libslic3r/Fill/FillGyroid.cpp | 12 ++++++------ src/libslic3r/Fill/FillGyroid.hpp | 2 +- src/libslic3r/Fill/FillHoneycomb.cpp | 2 +- src/libslic3r/Fill/FillHoneycomb.hpp | 2 +- src/libslic3r/Fill/FillPlanePath.cpp | 2 +- src/libslic3r/Fill/FillPlanePath.hpp | 2 +- src/libslic3r/Fill/FillRectilinear.cpp | 2 +- src/libslic3r/Fill/FillRectilinear.hpp | 2 +- src/libslic3r/Polygon.hpp | 2 +- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/libslic3r/ExPolygon.hpp b/src/libslic3r/ExPolygon.hpp index 373853f97..0056100b1 100644 --- a/src/libslic3r/ExPolygon.hpp +++ b/src/libslic3r/ExPolygon.hpp @@ -17,9 +17,9 @@ typedef std::vector ExPolygons; class ExPolygon { public: - ExPolygon() {} - ExPolygon(const ExPolygon &other) : contour(other.contour), holes(other.holes) {} - ExPolygon(ExPolygon &&other) noexcept : contour(std::move(other.contour)), holes(std::move(other.holes)) {} + ExPolygon() = default; + ExPolygon(const ExPolygon &other) = default; + ExPolygon(ExPolygon &&other) = default; explicit ExPolygon(const Polygon &contour) : contour(contour) {} explicit ExPolygon(Polygon &&contour) : contour(std::move(contour)) {} explicit ExPolygon(const Points &contour) : contour(contour) {} @@ -31,10 +31,10 @@ public: ExPolygon(std::initializer_list contour) : contour(contour) {} ExPolygon(std::initializer_list contour, std::initializer_list hole) : contour(contour), holes({ hole }) {} - ExPolygon& operator=(const ExPolygon &other) { contour = other.contour; holes = other.holes; return *this; } - ExPolygon& operator=(ExPolygon &&other) noexcept { contour = std::move(other.contour); holes = std::move(other.holes); return *this; } + ExPolygon& operator=(const ExPolygon &other) = default; + ExPolygon& operator=(ExPolygon &&other) = default; - Polygon contour; + Polygon contour; Polygons holes; operator Points() const; diff --git a/src/libslic3r/Fill/Fill3DHoneycomb.cpp b/src/libslic3r/Fill/Fill3DHoneycomb.cpp index 144a27505..69a7f9923 100644 --- a/src/libslic3r/Fill/Fill3DHoneycomb.cpp +++ b/src/libslic3r/Fill/Fill3DHoneycomb.cpp @@ -137,7 +137,7 @@ void Fill3DHoneycomb::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { // no rotation is supported for this infill pattern diff --git a/src/libslic3r/Fill/Fill3DHoneycomb.hpp b/src/libslic3r/Fill/Fill3DHoneycomb.hpp index 92c459a8d..2fc1cbe81 100644 --- a/src/libslic3r/Fill/Fill3DHoneycomb.hpp +++ b/src/libslic3r/Fill/Fill3DHoneycomb.hpp @@ -23,7 +23,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; }; diff --git a/src/libslic3r/Fill/FillAdaptive.cpp b/src/libslic3r/Fill/FillAdaptive.cpp index a1d592bc3..b9775fcda 100644 --- a/src/libslic3r/Fill/FillAdaptive.cpp +++ b/src/libslic3r/Fill/FillAdaptive.cpp @@ -1253,7 +1253,7 @@ void Filler::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { assert (this->adapt_fill_octree); diff --git a/src/libslic3r/Fill/FillAdaptive.hpp b/src/libslic3r/Fill/FillAdaptive.hpp index 01d9efb10..8ed05ba54 100644 --- a/src/libslic3r/Fill/FillAdaptive.hpp +++ b/src/libslic3r/Fill/FillAdaptive.hpp @@ -64,7 +64,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; bool no_sort() const override { return true; } }; diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index f73e6f528..4f8456bfa 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -120,7 +120,7 @@ protected: const FillParams & /* params */, unsigned int /* thickness_layers */, const std::pair & /* direction */, - ExPolygon & /* expolygon */, + ExPolygon /* expolygon */, Polylines & /* polylines_out */) {}; virtual float _layer_angle(size_t idx) const { return (idx & 1) ? float(M_PI/2.) : 0; } diff --git a/src/libslic3r/Fill/FillConcentric.cpp b/src/libslic3r/Fill/FillConcentric.cpp index 8a3a7ea89..587038178 100644 --- a/src/libslic3r/Fill/FillConcentric.cpp +++ b/src/libslic3r/Fill/FillConcentric.cpp @@ -10,7 +10,7 @@ void FillConcentric::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { // no rotation is supported for this infill pattern diff --git a/src/libslic3r/Fill/FillConcentric.hpp b/src/libslic3r/Fill/FillConcentric.hpp index 72adad3a4..04c2f4e31 100644 --- a/src/libslic3r/Fill/FillConcentric.hpp +++ b/src/libslic3r/Fill/FillConcentric.hpp @@ -16,7 +16,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; bool no_sort() const override { return true; } diff --git a/src/libslic3r/Fill/FillGyroid.cpp b/src/libslic3r/Fill/FillGyroid.cpp index b0cd507bc..c70c4439e 100644 --- a/src/libslic3r/Fill/FillGyroid.cpp +++ b/src/libslic3r/Fill/FillGyroid.cpp @@ -37,12 +37,12 @@ static inline Polyline make_wave( double period = points.back()(0); if (width != period) // do not extend if already truncated { - points.reserve(one_period.size() * floor(width / period)); + points.reserve(one_period.size() * size_t(floor(width / period))); points.pop_back(); - int n = points.size(); + size_t n = points.size(); do { - points.emplace_back(Vec2d(points[points.size()-n](0) + period, points[points.size()-n](1))); + points.emplace_back(points[points.size()-n].x() + period, points[points.size()-n].y()); } while (points.back()(0) < width - EPSILON); points.emplace_back(Vec2d(width, f(width, z_sin, z_cos, vertical, flip))); @@ -67,7 +67,7 @@ static std::vector make_one_period(double width, double scaleFactor, doub std::vector points; double dx = M_PI_2; // exact coordinates on main inflexion lobes double limit = std::min(2*M_PI, width); - points.reserve(ceil(limit / tolerance / 3)); + points.reserve(coord_t(ceil(limit / tolerance / 3))); for (double x = 0.; x < limit - EPSILON; x += dx) { points.emplace_back(Vec2d(x, f(x, z_sin, z_cos, vertical, flip))); @@ -152,10 +152,10 @@ void FillGyroid::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { - float infill_angle = this->angle + (CorrectionAngle * 2*M_PI) / 360.; + auto infill_angle = float(this->angle + (CorrectionAngle * 2*M_PI) / 360.); if(std::abs(infill_angle) >= EPSILON) expolygon.rotate(-infill_angle); diff --git a/src/libslic3r/Fill/FillGyroid.hpp b/src/libslic3r/Fill/FillGyroid.hpp index 4d45c47b0..ac66dfca9 100644 --- a/src/libslic3r/Fill/FillGyroid.hpp +++ b/src/libslic3r/Fill/FillGyroid.hpp @@ -32,7 +32,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; }; diff --git a/src/libslic3r/Fill/FillHoneycomb.cpp b/src/libslic3r/Fill/FillHoneycomb.cpp index aa0157fb9..8d80529ec 100644 --- a/src/libslic3r/Fill/FillHoneycomb.cpp +++ b/src/libslic3r/Fill/FillHoneycomb.cpp @@ -10,7 +10,7 @@ void FillHoneycomb::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { // cache hexagons math diff --git a/src/libslic3r/Fill/FillHoneycomb.hpp b/src/libslic3r/Fill/FillHoneycomb.hpp index 98a5f7a59..707e976fd 100644 --- a/src/libslic3r/Fill/FillHoneycomb.hpp +++ b/src/libslic3r/Fill/FillHoneycomb.hpp @@ -20,7 +20,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; // Caching the diff --git a/src/libslic3r/Fill/FillPlanePath.cpp b/src/libslic3r/Fill/FillPlanePath.cpp index 002fcadc0..0ce992ca3 100644 --- a/src/libslic3r/Fill/FillPlanePath.cpp +++ b/src/libslic3r/Fill/FillPlanePath.cpp @@ -10,7 +10,7 @@ void FillPlanePath::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { expolygon.rotate(- direction.first); diff --git a/src/libslic3r/Fill/FillPlanePath.hpp b/src/libslic3r/Fill/FillPlanePath.hpp index fe6b94162..cf19a95f8 100644 --- a/src/libslic3r/Fill/FillPlanePath.hpp +++ b/src/libslic3r/Fill/FillPlanePath.hpp @@ -23,7 +23,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; float _layer_angle(size_t idx) const override { return 0.f; } diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index c8c75f302..53f4dab33 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -11,7 +11,7 @@ void FillLine::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) { // rotate polygons so that we can work with vertical lines here diff --git a/src/libslic3r/Fill/FillRectilinear.hpp b/src/libslic3r/Fill/FillRectilinear.hpp index b7d27de22..c01224e6e 100644 --- a/src/libslic3r/Fill/FillRectilinear.hpp +++ b/src/libslic3r/Fill/FillRectilinear.hpp @@ -20,7 +20,7 @@ protected: const FillParams ¶ms, unsigned int thickness_layers, const std::pair &direction, - ExPolygon &expolygon, + ExPolygon expolygon, Polylines &polylines_out) override; coord_t _min_spacing; diff --git a/src/libslic3r/Polygon.hpp b/src/libslic3r/Polygon.hpp index 3c44f66f7..8479a0bd6 100644 --- a/src/libslic3r/Polygon.hpp +++ b/src/libslic3r/Polygon.hpp @@ -21,7 +21,7 @@ public: Point& operator[](Points::size_type idx) { return this->points[idx]; } const Point& operator[](Points::size_type idx) const { return this->points[idx]; } - Polygon() {} + Polygon() = default; virtual ~Polygon() = default; explicit Polygon(const Points &points) : MultiPoint(points) {} Polygon(std::initializer_list points) : MultiPoint(points) {}