Have Polygon inherit from Polyline

This commit is contained in:
Alessandro Ranellucci 2013-07-14 16:09:54 +02:00
parent 06de21b154
commit 8c1e1cc3ea
2 changed files with 80 additions and 35 deletions

View file

@ -8,47 +8,14 @@ extern "C" {
#include "ppport.h"
}
#include "Point.hpp"
#include "Polyline.hpp"
namespace Slic3r {
class Polygon
{
public:
Points points;
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);
};
class Polygon : public Polyline {};
typedef std::vector<Polygon> Polygons;
void
Polygon::scale(double factor)
{
for (Points::iterator it = points.begin(); it != points.end(); ++it) {
(*it).x *= factor;
(*it).y *= factor;
}
}
void
Polygon::translate(double x, double y)
{
for (Points::iterator it = points.begin(); it != points.end(); ++it) {
(*it).x += x;
(*it).y += y;
}
}
void
Polygon::rotate(double angle, Point* center)
{
for (Points::iterator it = points.begin(); it != points.end(); ++it) {
(*it).rotate(angle, center);
}
}
void
perl2polygon(SV* poly_sv, Polygon& poly)
{