Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/libslic3r/ExPolygon.hpp')
-rw-r--r--src/libslic3r/ExPolygon.hpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/libslic3r/ExPolygon.hpp b/src/libslic3r/ExPolygon.hpp
index 4aad3603f..b4651abc2 100644
--- a/src/libslic3r/ExPolygon.hpp
+++ b/src/libslic3r/ExPolygon.hpp
@@ -17,9 +17,9 @@ typedef std::vector<ExPolygon> 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<Point> contour) : contour(contour) {}
ExPolygon(std::initializer_list<Point> contour, std::initializer_list<Point> 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;
@@ -42,7 +42,8 @@ public:
operator Polylines() const;
void clear() { contour.points.clear(); holes.clear(); }
void scale(double factor);
- void translate(double x, double y);
+ void translate(double x, double y) { this->translate(Point(coord_t(x), coord_t(y))); }
+ void translate(const Point &vector);
void rotate(double angle);
void rotate(double angle, const Point &center);
double area() const;
@@ -333,6 +334,14 @@ extern std::list<TPPLPoly> expoly_to_polypartition_input(const ExPolygons &expp)
extern std::list<TPPLPoly> expoly_to_polypartition_input(const ExPolygon &ex);
extern std::vector<Point> polypartition_output_to_triangles(const std::list<TPPLPoly> &output);
+inline double area(const ExPolygons &polys)
+{
+ double s = 0.;
+ for (auto &p : polys) s += p.area();
+
+ return s;
+}
+
} // namespace Slic3r
// start Boost