Finished implementation of TriangleMesh->split

This commit is contained in:
Alessandro Ranellucci 2013-09-09 22:27:58 +02:00
parent 2d4aa439ae
commit 27e7c6b9f7
18 changed files with 59 additions and 23 deletions

View file

@ -10,7 +10,7 @@
ExPolygon* clone()
%code{% const char* CLASS = "Slic3r::ExPolygon"; RETVAL = new ExPolygon(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
%code{% RETVAL = THIS->to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
Polygon* contour()

View file

@ -8,7 +8,7 @@
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
~ExtrusionLoop();
SV* arrayref()
%code{% RETVAL = THIS->polygon.to_SV(); %};
%code{% RETVAL = THIS->polygon.to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->polygon.to_SV_pureperl(); %};
void reverse()

View file

@ -8,7 +8,7 @@
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
~ExtrusionPath();
SV* arrayref()
%code{% RETVAL = THIS->polyline.to_SV(); %};
%code{% RETVAL = THIS->polyline.to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->polyline.to_SV_pureperl(); %};
void pop_back()

View file

@ -10,7 +10,7 @@
Line* clone()
%code{% const char* CLASS = "Slic3r::Line"; RETVAL = new Line(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
%code{% RETVAL = THIS->to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
Point* a()

View file

@ -10,7 +10,7 @@
Polygon* clone()
%code{% const char* CLASS = "Slic3r::Polygon"; RETVAL = new Polygon(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
%code{% RETVAL = THIS->to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
void scale(double factor);

View file

@ -10,7 +10,7 @@
Polyline* clone()
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = new Polyline(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
%code{% RETVAL = THIS->to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
void scale(double factor);

View file

@ -16,6 +16,7 @@
void translate(float x, float y, float z);
void align_to_origin();
void rotate(double angle, Point* center);
TriangleMeshPtrs split();
%{
SV*

View file

@ -18,13 +18,22 @@ SurfaceType T_UV
ClipperLib::JoinType T_UV
ClipperLib::PolyFillType T_UV
# we return these types whenever we want the items to be cloned
Points T_ARRAYREF
Lines T_ARRAYREF
Polygons T_ARRAYREF
ExPolygons T_ARRAYREF
# we return these types whenever we want the items to be returned
# by reference and marked ::Ref because they're contained in another
# Perl object
Polygons* T_ARRAYREF_PTR
# we return these types whenever we want the items to be returned
# by reference and not marked ::Ref because they're newly allocated
# and not referenced by any Perl object
TriangleMeshPtrs T_PTR_ARRAYREF
INPUT
T_ARRAYREF
@ -52,7 +61,7 @@ T_ARRAYREF
av_extend(av, $var.size()-1);
int i = 0;
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
av_store(av, i++, (*it).to_SV_clone_ref());
av_store(av, i++, it->to_SV_clone_ref());
}
$var.clear();
@ -63,5 +72,15 @@ T_ARRAYREF_PTR
av_extend(av, $var->size()-1);
int i = 0;
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
av_store(av, i++, (*it).to_SV_ref());
av_store(av, i++, it->to_SV_ref());
}
T_PTR_ARRAYREF
AV* av = newAV();
$arg = newRV_noinc((SV*)av);
sv_2mortal($arg);
av_extend(av, $var.size()-1);
int i = 0;
for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
av_store(av, i++, (*it)->to_SV());
}

View file

@ -16,7 +16,7 @@
%typemap{Polygons};
%typemap{ExPolygons};
%typemap{Polygons*};
%typemap{Lines*};
%typemap{TriangleMeshPtrs};
%typemap{SurfaceType}{parsed}{
%cpp_type{SurfaceType};