Squash merge of lh_brim_rework,

brim separated to Brim.cpp,hpp
Refactored accessors to PrintObjectPtrs, PrintRegionPtrs, LayerPtrs,
SupportLayerPtrs for const correctness.
This commit is contained in:
Vojtech Bubnik 2021-02-03 15:12:53 +01:00
parent e52efe48b0
commit 73c9f939e0
37 changed files with 803 additions and 243 deletions

View file

@ -49,6 +49,7 @@ public:
double area() const;
bool empty() const { return contour.points.empty(); }
bool is_valid() const;
void douglas_peucker(double tolerance);
// Contains the line / polyline / polylines etc COMPLETELY.
bool contains(const Line &line) const;
@ -249,6 +250,24 @@ inline Polygons to_polygons(ExPolygons &&src)
return polygons;
}
inline ExPolygons to_expolygons(const Polygons &polys)
{
ExPolygons ex_polys;
ex_polys.assign(polys.size(), ExPolygon());
for (size_t idx = 0; idx < polys.size(); ++idx)
ex_polys[idx].contour = polys[idx];
return ex_polys;
}
inline ExPolygons to_expolygons(Polygons &&polys)
{
ExPolygons ex_polys;
ex_polys.assign(polys.size(), ExPolygon());
for (size_t idx = 0; idx < polys.size(); ++idx)
ex_polys[idx].contour = std::move(polys[idx]);
return ex_polys;
}
inline void polygons_append(Polygons &dst, const ExPolygon &src)
{
dst.reserve(dst.size() + src.holes.size() + 1);