Ported ExtrusionPath to XS. Failing test for Surface

This commit is contained in:
Alessandro Ranellucci 2013-07-15 12:14:22 +02:00
parent 8c1e1cc3ea
commit f612d4c64e
24 changed files with 501 additions and 143 deletions

View file

@ -0,0 +1,60 @@
#ifndef slic3r_ExtrusionEntity_hpp_
#define slic3r_ExtrusionEntity_hpp_
extern "C" {
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
}
#include "Polygon.hpp"
#include "Polyline.hpp"
namespace Slic3r {
enum ExtrusionRole {
erPerimeter,
erExternalPerimeter,
erOverhangPerimeter,
erContourInternalPerimeter,
erFill,
erSolidFill,
erTopSolidFill,
erBrige,
erInternalBridge,
erSkirt,
erSupportMaterial,
erGapFill,
};
class ExtrusionEntity
{
public:
ExtrusionRole role;
double height; // vertical thickness of the extrusion expressed in mm
double flow_spacing;
};
class ExtrusionPath : public ExtrusionEntity
{
public:
Polyline polyline;
void reverse();
};
class ExtrusionLoop : public ExtrusionEntity
{
public:
Polygon polygon;
};
void
ExtrusionPath::reverse()
{
this->polyline.reverse();
}
}
#endif

View file

@ -9,6 +9,7 @@ extern "C" {
}
#include "Point.hpp"
#include <algorithm>
namespace Slic3r {
@ -19,6 +20,7 @@ class Polyline
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);
void reverse();
};
typedef std::vector<Polyline> Polylines;
@ -49,6 +51,12 @@ Polyline::rotate(double angle, Point* center)
}
}
void
Polyline::reverse()
{
std::reverse(this->points.begin(), this->points.end());
}
void
perl2polyline(SV* poly_sv, Polyline& poly)
{