Merge branch 'master' into boost-medialaxis

Conflicts:
	lib/Slic3r/Layer/Region.pm
	xs/src/ExPolygon.cpp
	xs/src/Point.cpp
	xs/src/Point.hpp
	xs/src/TriangleMesh.cpp
	xs/t/01_trianglemesh.t
This commit is contained in:
Alessandro Ranellucci 2014-03-02 22:36:20 +01:00
commit eadffe4a9e
72 changed files with 1928 additions and 949 deletions

View file

@ -24,6 +24,7 @@
%code{% THIS->apply(*other, true); %};
std::vector<std::string> get_keys()
%code{% THIS->keys(&RETVAL); %};
void erase(t_config_option_key opt_key);
};
%name{Slic3r::Config::Print} class PrintConfig {
@ -146,14 +147,13 @@ print_config_def()
throw "Unknown option type";
}
(void)hv_stores( hv, "type", newSVpv(opt_type, 0) );
(void)hv_stores( hv, "label", newSVpvn(optdef->label.c_str(), optdef->label.length()) );
(void)hv_stores( hv, "label", newSVpvn_utf8(optdef->label.c_str(), optdef->label.length(), true) );
if (!optdef->full_label.empty())
(void)hv_stores( hv, "full_label", newSVpvn(optdef->full_label.c_str(), optdef->full_label.length()) );
(void)hv_stores( hv, "full_label", newSVpvn_utf8(optdef->full_label.c_str(), optdef->full_label.length(), true) );
(void)hv_stores( hv, "category", newSVpvn(optdef->category.c_str(), optdef->category.length()) );
(void)hv_stores( hv, "tooltip", newSVpvn(optdef->tooltip.c_str(), optdef->tooltip.length()) );
(void)hv_stores( hv, "sidetext", newSVpvn(optdef->sidetext.c_str(), optdef->sidetext.length()) );
(void)hv_stores( hv, "tooltip", newSVpvn_utf8(optdef->tooltip.c_str(), optdef->tooltip.length(), true) );
(void)hv_stores( hv, "sidetext", newSVpvn_utf8(optdef->sidetext.c_str(), optdef->sidetext.length(), true) );
(void)hv_stores( hv, "cli", newSVpvn(optdef->cli.c_str(), optdef->cli.length()) );
(void)hv_stores( hv, "scope", newSVpvn(optdef->scope.c_str(), optdef->scope.length()) );
(void)hv_stores( hv, "ratio_over", newSVpvn(optdef->ratio_over.c_str(), optdef->ratio_over.length()) );
(void)hv_stores( hv, "multiline", newSViv(optdef->multiline ? 1 : 0) );
(void)hv_stores( hv, "full_width", newSViv(optdef->full_width ? 1 : 0) );
@ -195,7 +195,7 @@ print_config_def()
AV* av = newAV();
av_fill(av, optdef->enum_labels.size()-1);
for (std::vector<std::string>::iterator it = optdef->enum_labels.begin(); it != optdef->enum_labels.end(); ++it)
av_store(av, it - optdef->enum_labels.begin(), newSVpvn(it->c_str(), it->length()));
av_store(av, it - optdef->enum_labels.begin(), newSVpvn_utf8(it->c_str(), it->length(), true));
(void)hv_stores( hv, "labels", newRV_noinc((SV*)av) );
}

View file

@ -24,6 +24,9 @@
Point* nearest_point(Points points)
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->nearest_point(points))); %};
double distance_to(Point* point);
%name{distance_to_line} double distance_to(Line* line);
double ccw(Point* p1, Point* p2)
%code{% RETVAL = THIS->ccw(*p1, *p2); %};
%{

View file

@ -16,6 +16,7 @@
%code{% RETVAL = THIS->thickness_layers; %};
double area();
bool is_solid() const;
bool is_external() const;
bool is_bridge() const;
%{

View file

@ -22,7 +22,7 @@ SurfaceCollection::new(...)
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].from_SV_check(ST(i));
}
OUTPUT:
RETVAL
@ -56,8 +56,9 @@ void
SurfaceCollection::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
// Note: a COPY of the input is stored
THIS->surfaces.push_back(*(Surface *)SvIV((SV*)SvRV( ST(i) )));
Surface surface;
surface.from_SV_check( ST(i) );
THIS->surfaces.push_back(surface);
}
void
@ -75,12 +76,11 @@ SurfaceCollection::set_surface_type(index, surface_type)
THIS->surfaces[index].surface_type = surface_type;
SV*
SurfaceCollection::group(merge_solid = false)
bool merge_solid
SurfaceCollection::group()
CODE:
// perform grouping
std::vector<SurfacesPtr> groups;
THIS->group(&groups, merge_solid);
THIS->group(&groups);
// build return arrayref
AV* av = newAV();

View file

@ -32,6 +32,8 @@
RETVAL = new BoundingBoxf3();
THIS->bounding_box(RETVAL);
%};
int facets_count()
%code{% RETVAL = THIS->stl.stats.number_of_facets; %};
%{
SV*
@ -137,8 +139,13 @@ SV*
TriangleMesh::slice(z)
std::vector<double>* z
CODE:
// convert doubles to floats
std::vector<float> z_f(z->begin(), z->end());
delete z;
std::vector<ExPolygons> layers;
THIS->slice(*z, &layers);
TriangleMeshSlicer mslicer(THIS);
mslicer.slice(z_f, &layers);
AV* layers_av = newAV();
av_extend(layers_av, layers.size()-1);
@ -155,6 +162,15 @@ TriangleMesh::slice(z)
OUTPUT:
RETVAL
void
TriangleMesh::cut(z, upper, lower)
float z;
TriangleMesh* upper;
TriangleMesh* lower;
CODE:
TriangleMeshSlicer mslicer(THIS);
mslicer.cut(z, upper, lower);
std::vector<double>
TriangleMesh::bb3()
CODE: