mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Have Polygon inherit from Polyline
This commit is contained in:
parent
06de21b154
commit
8c1e1cc3ea
2 changed files with 80 additions and 35 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue