Add static method to create scaled Polygons from Pointf arrays.

This commit is contained in:
Joseph Lenox 2018-05-05 16:10:43 -05:00
parent 2b91524619
commit 4860d63b01
2 changed files with 13 additions and 0 deletions

View File

@ -293,4 +293,15 @@ Polygon::convex_points(double angle) const
return convex;
}
Polygon Polygon::new_scale(const Pointfs& p) {
Points scaled_p;
for (auto i : p) {
// scale each individual point and append to a new array
scaled_p.push_back(scale_(i.x), scale_(i.y));
}
return Slic3r::Polygon(scaled_p);
};
}

View File

@ -48,6 +48,8 @@ class Polygon : public MultiPoint {
std::string wkt() const;
Points concave_points(double angle = PI) const;
Points convex_points(double angle = PI) const;
static Polygon new_scale(const Pointfs& p);
};
inline Polygons