mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 07:41:09 -06:00
Use XS Point everywhere
This commit is contained in:
parent
d0701cdcd4
commit
9af2a1c007
37 changed files with 238 additions and 303 deletions
|
@ -6,11 +6,12 @@
|
|||
%}
|
||||
|
||||
%name{Slic3r::ExPolygon::XS} class ExPolygon {
|
||||
~ExPolygon();
|
||||
ExPolygon* clone()
|
||||
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); %};
|
||||
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); RETVAL->in_collection = false; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = expolygon2perl(*THIS); %};
|
||||
%code{% RETVAL = THIS->to_SV(true, false); %};
|
||||
SV* arrayref_pp()
|
||||
%code{% RETVAL = THIS->to_SV(true, true); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
%{
|
||||
|
@ -20,14 +21,22 @@ ExPolygon::new(...)
|
|||
CODE:
|
||||
RETVAL = new ExPolygon ();
|
||||
// ST(0) is class name, ST(1) is contour and others are holes
|
||||
perl2polygon(ST(1), RETVAL->contour);
|
||||
RETVAL->contour.from_SV_check(ST(1));
|
||||
RETVAL->holes.resize(items-2);
|
||||
for (unsigned int i = 2; i < items; i++) {
|
||||
perl2polygon(ST(i), RETVAL->holes[i-2]);
|
||||
RETVAL->holes[i-2].from_SV_check(ST(i));
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExPolygon::DESTROY()
|
||||
CODE:
|
||||
if (!THIS->in_collection) {
|
||||
delete THIS;
|
||||
THIS = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ExPolygon::rotate(angle, center_sv)
|
||||
double angle;
|
||||
|
|
|
@ -23,13 +23,8 @@ ExPolygonCollection::new(...)
|
|||
// ST(0) is class name, others are expolygons
|
||||
RETVAL->expolygons.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
|
||||
// a XS ExPolygon was supplied
|
||||
RETVAL->expolygons[i-1] = *(ExPolygon *)SvIV((SV*)SvRV( ST(i) ));
|
||||
} else {
|
||||
// a Perl arrayref was supplied
|
||||
perl2expolygon(ST(i), RETVAL->expolygons[i-1]);
|
||||
}
|
||||
perl2expolygon_check(ST(i), RETVAL->expolygons[i-1]);
|
||||
RETVAL->expolygons[i-1].in_collection = true;
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -41,7 +36,20 @@ ExPolygonCollection::arrayref()
|
|||
av_fill(av, THIS->expolygons.size()-1);
|
||||
int i = 0;
|
||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, expolygon2perl(*it));
|
||||
av_store(av, i++, (*it).to_SV(false, false));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
ExPolygonCollection::arrayref_pp()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->expolygons.size()-1);
|
||||
int i = 0;
|
||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, (*it).to_SV(true, true));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
|
@ -52,6 +60,7 @@ ExPolygonCollection::append(...)
|
|||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
THIS->expolygons.push_back(*(ExPolygon *)SvIV((SV*)SvRV( ST(i) )));
|
||||
THIS->expolygons.back().in_collection = true;
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
|
||||
~ExtrusionLoop();
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = polygon2perl(THIS->polygon); %};
|
||||
%code{% RETVAL = THIS->polygon.to_SV(true, false); %};
|
||||
SV* arrayref_pp()
|
||||
%code{% RETVAL = THIS->polygon.to_SV(true, true); %};
|
||||
Polygon* as_polygon()
|
||||
%code{% const char* CLASS = "Slic3r::Polygon::XS"; RETVAL = new Polygon(THIS->polygon); %};
|
||||
void set_polygon(SV* polygon_sv)
|
||||
%code{% perl2polygon_check(polygon_sv, THIS->polygon); %};
|
||||
%code{% THIS->polygon.from_SV_check(polygon_sv); %};
|
||||
%{
|
||||
|
||||
ExtrusionLoop*
|
||||
|
@ -24,7 +26,7 @@ _new(CLASS, polygon_sv, role, height, flow_spacing)
|
|||
double flow_spacing;
|
||||
CODE:
|
||||
RETVAL = new ExtrusionLoop ();
|
||||
perl2polygon_check(polygon_sv, RETVAL->polygon);
|
||||
RETVAL->polygon.from_SV_check(polygon_sv);
|
||||
RETVAL->role = role;
|
||||
RETVAL->height = height;
|
||||
RETVAL->flow_spacing = flow_spacing;
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
|
||||
~ExtrusionPath();
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = polyline2perl(THIS->polyline); %};
|
||||
%code{% RETVAL = THIS->polyline.to_SV(true, false); %};
|
||||
SV* arrayref_pp()
|
||||
%code{% RETVAL = THIS->polyline.to_SV(true, true); %};
|
||||
Polyline* as_polyline()
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(THIS->polyline); %};
|
||||
void set_polyline(SV* polyline_sv)
|
||||
%code{% perl2polyline_check(polyline_sv, THIS->polyline); %};
|
||||
%code{% THIS->polyline.from_SV_check(polyline_sv); %};
|
||||
void pop_back()
|
||||
%code{% THIS->polyline.points.pop_back(); %};
|
||||
void reverse();
|
||||
|
@ -27,7 +29,7 @@ _new(CLASS, polyline_sv, role, height, flow_spacing)
|
|||
double flow_spacing;
|
||||
CODE:
|
||||
RETVAL = new ExtrusionPath ();
|
||||
perl2polyline_check(polyline_sv, RETVAL->polyline);
|
||||
RETVAL->polyline.from_SV_check(polyline_sv);
|
||||
RETVAL->role = role;
|
||||
RETVAL->height = height;
|
||||
RETVAL->flow_spacing = flow_spacing;
|
||||
|
|
|
@ -5,15 +5,19 @@
|
|||
#include "Point.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Point::XS} class Point {
|
||||
%name{Slic3r::Point} class Point {
|
||||
Point(unsigned long _x = 0, unsigned long _y = 0);
|
||||
~Point();
|
||||
Point* clone()
|
||||
%code{% const char* CLASS = "Slic3r::Point::XS"; RETVAL = new Point(*THIS); %};
|
||||
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*THIS); %};
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = point2perl(*THIS); %};
|
||||
%code{% RETVAL = THIS->to_SV(true); %};
|
||||
unsigned long x()
|
||||
%code{% RETVAL = THIS->x; %};
|
||||
unsigned long y()
|
||||
%code{% RETVAL = THIS->y; %};
|
||||
|
||||
%{
|
||||
|
||||
|
@ -39,16 +43,3 @@ Point::coincides_with(point_sv)
|
|||
%}
|
||||
|
||||
};
|
||||
|
||||
%package{Slic3r::Point::XS};
|
||||
|
||||
%{
|
||||
PROTOTYPES: DISABLE
|
||||
|
||||
std::string
|
||||
hello_world()
|
||||
CODE:
|
||||
RETVAL = "Hello world!";
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
%}
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
Polygon* clone()
|
||||
%code{% const char* CLASS = "Slic3r::Polygon::XS"; RETVAL = new Polygon(*THIS); %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = polygon2perl(*THIS); %};
|
||||
%code{% RETVAL = THIS->to_SV(true, false); %};
|
||||
SV* arrayref_pp()
|
||||
%code{% RETVAL = THIS->to_SV(true, true); %};
|
||||
%{
|
||||
|
||||
Polygon*
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
Polyline* clone()
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(*THIS); %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = polyline2perl(*THIS); %};
|
||||
%code{% RETVAL = THIS->to_SV(true, false); %};
|
||||
SV* arrayref_pp()
|
||||
%code{% RETVAL = THIS->to_SV(true, true); %};
|
||||
void pop_back()
|
||||
%code{% THIS->points.pop_back(); %};
|
||||
void reverse();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue