mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 15:51:10 -06:00
Merge branch 'master' into xsdata
Conflicts: lib/Slic3r.pm lib/Slic3r/ExPolygon.pm lib/Slic3r/Fill.pm lib/Slic3r/Fill/Rectilinear.pm lib/Slic3r/GCode.pm lib/Slic3r/GUI/Plater.pm lib/Slic3r/Geometry/Clipper.pm lib/Slic3r/Layer/Region.pm lib/Slic3r/Print.pm lib/Slic3r/Print/Object.pm lib/Slic3r/TriangleMesh.pm t/shells.t xs/MANIFEST
This commit is contained in:
commit
b38cc2c244
60 changed files with 1432 additions and 798 deletions
|
@ -119,4 +119,12 @@ union_ex(subject, safety_offset = false)
|
|||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygons
|
||||
simplify_polygons(subject)
|
||||
Polygons subject
|
||||
CODE:
|
||||
simplify_polygons(subject, RETVAL);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
%}
|
||||
|
||||
%name{Slic3r::ExPolygon} class ExPolygon {
|
||||
~ExPolygon();
|
||||
ExPolygon* clone()
|
||||
%code{% const char* CLASS = "Slic3r::ExPolygon"; RETVAL = new ExPolygon(*THIS); RETVAL->in_collection = false; %};
|
||||
%code{% const char* CLASS = "Slic3r::ExPolygon"; RETVAL = new ExPolygon(*THIS); %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = THIS->to_SV(); %};
|
||||
SV* pp()
|
||||
|
@ -29,14 +30,6 @@ ExPolygon::new(...)
|
|||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExPolygon::DESTROY()
|
||||
CODE:
|
||||
if (!THIS->in_collection) {
|
||||
delete THIS;
|
||||
THIS = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ExPolygon::rotate(angle, center_sv)
|
||||
double angle;
|
||||
|
|
|
@ -24,9 +24,7 @@ ExPolygonCollection::new(...)
|
|||
RETVAL->expolygons.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
// Note: a COPY of the input is stored
|
||||
RETVAL->expolygons[i-1] = new ExPolygon;
|
||||
RETVAL->expolygons[i-1]->from_SV_check(ST(i));
|
||||
RETVAL->expolygons[i-1]->in_collection = true;
|
||||
RETVAL->expolygons[i-1].from_SV_check(ST(i));
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -37,10 +35,8 @@ ExPolygonCollection::arrayref()
|
|||
AV* av = newAV();
|
||||
av_fill(av, THIS->expolygons.size()-1);
|
||||
int i = 0;
|
||||
for (ExPolygonsPtr::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, "Slic3r::ExPolygon", *it );
|
||||
av_store(av, i++, sv);
|
||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, (*it).to_SV_ref());
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
|
@ -52,8 +48,8 @@ ExPolygonCollection::pp()
|
|||
AV* av = newAV();
|
||||
av_fill(av, THIS->expolygons.size()-1);
|
||||
int i = 0;
|
||||
for (ExPolygonsPtr::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, (*it)->to_SV_pureperl());
|
||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, (*it).to_SV_pureperl());
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
|
@ -63,9 +59,8 @@ void
|
|||
ExPolygonCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
ExPolygon* expolygon = new ExPolygon;
|
||||
expolygon->from_SV_check( ST(i) );
|
||||
expolygon->in_collection = true;
|
||||
ExPolygon expolygon;
|
||||
expolygon.from_SV_check( ST(i) );
|
||||
THIS->expolygons.push_back(expolygon);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
#include <myinit.h>
|
||||
#include "ZTable.hpp"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
%}
|
||||
|
||||
%name{Slic3r::Object::XS::ZTable} class ZTable {
|
||||
ZTable(std::vector<unsigned int>* z_array);
|
||||
~ZTable();
|
||||
|
||||
%{
|
||||
std::vector<unsigned int>
|
||||
|
@ -47,6 +49,25 @@ get_range(THIS, min_z, max_z)
|
|||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
unsigned int
|
||||
ZTable::lower_bound(z, offset = 0)
|
||||
unsigned int z
|
||||
unsigned int offset
|
||||
CODE:
|
||||
RETVAL = std::lower_bound(THIS->z.begin() + offset, THIS->z.end(), z) - THIS->z.begin();
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
unsigned int
|
||||
ZTable::upper_bound(z, offset = 0)
|
||||
unsigned int z
|
||||
unsigned int offset
|
||||
CODE:
|
||||
RETVAL = std::upper_bound(THIS->z.begin() + offset, THIS->z.end(), z) - THIS->z.begin();
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
%}
|
||||
|
||||
%name{Slic3r::Surface} class Surface {
|
||||
~Surface();
|
||||
ExPolygon* expolygon()
|
||||
%code{% const char* CLASS = "Slic3r::ExPolygon"; RETVAL = new ExPolygon(THIS->expolygon); %};
|
||||
double thickness()
|
||||
|
@ -31,17 +32,11 @@ _new(CLASS, expolygon, surface_type, thickness, thickness_layers, bridge_angle,
|
|||
RETVAL->thickness_layers = thickness_layers;
|
||||
RETVAL->bridge_angle = bridge_angle;
|
||||
RETVAL->extra_perimeters = extra_perimeters;
|
||||
// we don't delete expolygon here because it's referenced by a Perl SV
|
||||
// whose DESTROY will take care of destruction
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
Surface::DESTROY()
|
||||
CODE:
|
||||
if (!THIS->in_collection) {
|
||||
delete THIS;
|
||||
THIS = NULL;
|
||||
}
|
||||
|
||||
SurfaceType
|
||||
Surface::surface_type(...)
|
||||
CODE:
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
SurfaceCollection*
|
||||
SurfaceCollection::new(...)
|
||||
CODE:
|
||||
RETVAL = new SurfaceCollection ();
|
||||
RETVAL = new SurfaceCollection;
|
||||
// ST(0) is class name, others are surfaces
|
||||
RETVAL->surfaces.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
// Note: a COPY of the input is stored
|
||||
RETVAL->surfaces[i-1] = (Surface *)SvIV((SV*)SvRV( ST(i) ));
|
||||
RETVAL->surfaces[i-1]->in_collection = true;
|
||||
RETVAL->surfaces[i-1] = *(Surface *)SvIV((SV*)SvRV( ST(i) ));
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -31,9 +30,9 @@ SurfaceCollection::arrayref()
|
|||
AV* av = newAV();
|
||||
av_fill(av, THIS->surfaces.size()-1);
|
||||
int i = 0;
|
||||
for (SurfacesPtr::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, "Slic3r::Surface", *it );
|
||||
sv_setref_pv( sv, "Slic3r::Surface", new Surface(*it) );
|
||||
av_store(av, i++, sv);
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
|
@ -44,9 +43,22 @@ void
|
|||
SurfaceCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
THIS->surfaces.push_back((Surface *)SvIV((SV*)SvRV( ST(i) )));
|
||||
THIS->surfaces.back()->in_collection = true;
|
||||
THIS->surfaces.push_back(*(Surface *)SvIV((SV*)SvRV( ST(i) )));
|
||||
}
|
||||
|
||||
void
|
||||
SurfaceCollection::replace(index, surface)
|
||||
int index
|
||||
Surface* surface
|
||||
CODE:
|
||||
THIS->surfaces[index] = *surface;
|
||||
|
||||
void
|
||||
SurfaceCollection::set_surface_type(index, surface_type)
|
||||
int index
|
||||
SurfaceType surface_type;
|
||||
CODE:
|
||||
THIS->surfaces[index].surface_type = surface_type;
|
||||
|
||||
%}
|
||||
};
|
||||
|
|
|
@ -44,8 +44,9 @@ OUTPUT
|
|||
T_ARRAYREF
|
||||
AV* av = newAV();
|
||||
$arg = newRV_noinc((SV*)av);
|
||||
const unsigned int len = $var.size();
|
||||
av_extend(av, len-1);
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
av_store(av, i, ${var}[i].to_SV_ref());
|
||||
}
|
||||
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_ref());
|
||||
}
|
||||
$var.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue