Ported intersect_expolygons() and subtract_expolygons() to XS

This commit is contained in:
Alessandro Ranellucci 2013-11-21 17:53:50 +01:00
parent 5f81292f3f
commit 761f261a68
11 changed files with 95 additions and 29 deletions

View file

@ -2,6 +2,18 @@
namespace Slic3r {
ExPolygonCollection::operator Polygons() const
{
Polygons polygons;
for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) {
polygons.push_back(it->contour);
for (Polygons::const_iterator ith = it->holes.begin(); ith != it->holes.end(); ++ith) {
polygons.push_back(*ith);
}
}
return polygons;
}
void
ExPolygonCollection::scale(double factor)
{
@ -26,4 +38,13 @@ ExPolygonCollection::rotate(double angle, Point* center)
}
}
bool
ExPolygonCollection::contains_point(const Point* point) const
{
for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) {
if (it->contains_point(point)) return true;
}
return false;
}
}