New ->scale() method for ExPolygon::XS

This commit is contained in:
Alessandro Ranellucci 2013-07-11 14:08:11 +02:00
parent 5409c27852
commit e0052b01d3
3 changed files with 24 additions and 1 deletions

View file

@ -19,8 +19,24 @@ class ExPolygon
Polygon contour;
Polygons holes;
SV* arrayref();
void scale(double factor);
};
#define scale_polygon(poly, factor) \
for (Polygon::iterator pit = (poly).begin(); pit != (poly).end(); ++pit) { \
(*pit).x *= factor; \
(*pit).y *= factor; \
}
void
ExPolygon::scale(double factor)
{
scale_polygon(contour, factor);
for (Polygons::iterator it = holes.begin(); it != holes.end(); ++it) {
scale_polygon(*it, factor);
}
}
void
perl2polygon(SV* poly_sv, Polygon& poly)
{