Merge branch 'master' into sender

Conflicts:
	Build.PL
This commit is contained in:
Alessandro Ranellucci 2015-02-01 14:07:32 +01:00
commit 3ae6f2630e
106 changed files with 2262 additions and 994 deletions

View file

@ -16,8 +16,7 @@
void scale(double factor);
void translate(double x, double y);
void offset(double delta);
Polygon* polygon()
%code{% RETVAL = new Polygon(); THIS->polygon(RETVAL); %};
Clone<Polygon> polygon();
Clone<Point> size();
Clone<Point> center();
Clone<Point> min_point() %code{% RETVAL = THIS->min; %};
@ -88,6 +87,8 @@ new_from_points(CLASS, points)
void translate(double x, double y, double z);
Clone<Pointf3> size();
Clone<Pointf3> center();
Clone<Pointf3> min_point() %code{% RETVAL = THIS->min; %};
Clone<Pointf3> max_point() %code{% RETVAL = THIS->max; %};
double x_min() %code{% RETVAL = THIS->min.x; %};
double x_max() %code{% RETVAL = THIS->max.x; %};
double y_min() %code{% RETVAL = THIS->min.y; %};

View file

@ -26,6 +26,7 @@
void simplify(double tolerance);
Polygons polygons()
%code{% RETVAL = *THIS; %};
Clone<Polygon> convex_hull();
%{
ExPolygonCollection*
@ -76,13 +77,5 @@ ExPolygonCollection::append(...)
THIS->expolygons.push_back(expolygon);
}
Polygon*
ExPolygonCollection::convex_hull()
CODE:
RETVAL = new Polygon ();
THIS->convex_hull(RETVAL);
OUTPUT:
RETVAL
%}
};

View file

@ -24,8 +24,11 @@
Clone<Point> last_point();
int count()
%code{% RETVAL = THIS->entities.size(); %};
bool empty()
%code{% RETVAL = THIS->entities.empty(); %};
std::vector<size_t> orig_indices()
%code{% RETVAL = THIS->orig_indices; %};
Polygons grow();
%{
void

View file

@ -15,8 +15,7 @@
bool make_counter_clockwise();
Clone<Point> first_point();
Clone<Point> last_point();
Polygon* polygon()
%code{% RETVAL = new Polygon (*THIS); %};
Clone<Polygon> polygon();
void append(ExtrusionPath* path)
%code{% THIS->paths.push_back(*path); %};
double length();
@ -31,6 +30,7 @@
bool is_perimeter();
bool is_infill();
bool is_solid_infill();
Polygons grow();
%{
SV*

View file

@ -29,6 +29,7 @@
std::string gcode(Extruder* extruder, double e, double F,
double xofs, double yofs, std::string extrusion_axis,
std::string gcode_line_suffix);
Polygons grow();
%{
ExtrusionPath*

28
xs/xsp/GUI_3DScene.xsp Normal file
View file

@ -0,0 +1,28 @@
%module{Slic3r::XS};
#include <myinit.h>
#include "libslic3r/GUI/3DScene.hpp"
%name{Slic3r::GUI::_3DScene::GLVertexArray} class GLVertexArray {
GLVertexArray();
~GLVertexArray();
void load_mesh(TriangleMesh* mesh) const
%code%{ THIS->load_mesh(*mesh); %};
size_t size() const
%code%{ RETVAL = THIS->verts.size(); %};
void* verts_ptr() const
%code%{ RETVAL = THIS->verts.empty() ? 0 : &THIS->verts.front(); %};
void* norms_ptr() const
%code%{ RETVAL = THIS->verts.empty() ? 0 : &THIS->norms.front(); %};
};
%package{Slic3r::GUI::_3DScene};
%{
void
_extrusionentity_to_verts_do(Lines lines, std::vector<double> widths, std::vector<double> heights, bool closed, double top_z, Point* copy, GLVertexArray* qverts, GLVertexArray* tverts)
CODE:
_3DScene::_extrusionentity_to_verts_do(lines, widths, heights, closed,
top_z, *copy, qverts, tverts);
%}

View file

@ -29,12 +29,11 @@ directions_parallel_within(angle1, angle2, max_diff)
OUTPUT:
RETVAL
Polygon*
Clone<Polygon>
convex_hull(points)
Points points
CODE:
RETVAL = new Polygon ();
Slic3r::Geometry::convex_hull(points, RETVAL);
RETVAL = Slic3r::Geometry::convex_hull(points);
OUTPUT:
RETVAL
@ -79,4 +78,13 @@ deg2rad(angle)
OUTPUT:
RETVAL
Polygons
simplify_polygons(polygons, tolerance)
Polygons polygons
double tolerance
CODE:
Slic3r::Geometry::simplify_polygons(polygons, tolerance, &RETVAL);
OUTPUT:
RETVAL
%}

View file

@ -26,15 +26,17 @@
Ref<ExtrusionEntityCollection> fills()
%code%{ RETVAL = &THIS->fills; %};
Flow* flow(FlowRole role, bool bridge = false, double width = -1)
%code%{ RETVAL = new Flow(THIS->flow(role, bridge, width)); %};
Clone<Flow> flow(FlowRole role, bool bridge = false, double width = -1)
%code%{ RETVAL = THIS->flow(role, bridge, width); %};
void merge_slices();
void prepare_fill_surfaces();
};
%name{Slic3r::Layer} class Layer {
// owned by PrintObject, no constructor/destructor
int id();
void set_id(int id);
Ref<PrintObject> object();
Ref<Layer> upper_layer()
%code%{ RETVAL = THIS->upper_layer; %};
@ -89,6 +91,7 @@
// copies of some Layer methods, because the parameter wrapper code
// gets confused about getting a Layer::Support instead of a Layer
int id();
void set_id(int id);
Ref<PrintObject> object();
Ref<SupportLayer> upper_layer()
%code%{ RETVAL = (SupportLayer*)THIS->upper_layer; %};

View file

@ -28,11 +28,19 @@
bool parallel_to(double angle);
bool parallel_to_line(Line* line)
%code{% RETVAL = THIS->parallel_to(*line); %};
Point* midpoint();
Clone<Point> midpoint();
Clone<Point> point_at(double distance);
Polyline* as_polyline()
%code{% RETVAL = new Polyline(*THIS); %};
Clone<Point> intersection_infinite(Line* other)
%code{%
Point p;
bool res = THIS->intersection_infinite(*other, &p);
if (!res) CONFESS("Intersection failed");
RETVAL = p;
%};
Clone<Polyline> as_polyline()
%code{% RETVAL = Polyline(*THIS); %};
Clone<Point> normal();
Clone<Point> vector();
%{
Line*
@ -79,4 +87,5 @@ Line::coincides_with(line_sv)
Ref<Pointf3> b()
%code{% RETVAL = &THIS->b; %};
Clone<Pointf3> intersect_plane(double z);
void scale(double factor);
};

View file

@ -59,19 +59,13 @@
// void duplicate(size_t copies_num, coordf_t distance, const BoundingBox &bb);
bool has_objects_with_no_instances();
bool add_default_instances();
BoundingBoxf3* bounding_box()
%code%{
RETVAL = new BoundingBoxf3();
THIS->bounding_box(RETVAL);
%};
Clone<BoundingBoxf3> bounding_box();
void center_instances_around_point(Pointf* point)
%code%{ THIS->center_instances_around_point(*point); %};
void align_instances_to_origin();
void translate(double x, double y, double z);
TriangleMesh* mesh()
%code%{ RETVAL = new TriangleMesh(); THIS->mesh(RETVAL); %};
TriangleMesh* raw_mesh()
%code%{ RETVAL = new TriangleMesh(); THIS->raw_mesh(RETVAL); %};
Clone<TriangleMesh> mesh();
Clone<TriangleMesh> raw_mesh();
// void split_meshes();
// std::string get_material_name(t_model_material_id material_id);
@ -119,20 +113,10 @@ ModelMaterial::attributes()
void invalidate_bounding_box();
void update_bounding_box();
TriangleMesh* mesh()
%code%{ RETVAL = new TriangleMesh(); THIS->mesh(RETVAL); %};
TriangleMesh* raw_mesh()
%code%{ RETVAL = new TriangleMesh(); THIS->raw_mesh(RETVAL); %};
BoundingBoxf3* raw_bounding_box()
%code%{
RETVAL = new BoundingBoxf3();
THIS->raw_bounding_box(RETVAL);
%};
BoundingBoxf3* instance_bounding_box(int idx)
%code%{
RETVAL = new BoundingBoxf3();
THIS->instance_bounding_box(idx, RETVAL);
%};
Clone<TriangleMesh> mesh();
Clone<TriangleMesh> raw_mesh();
Clone<BoundingBoxf3> raw_bounding_box();
Clone<BoundingBoxf3> instance_bounding_box(int idx);
Ref<BoundingBoxf3> _bounding_box(BoundingBoxf3* new_bbox = NULL)
%code{%
@ -147,11 +131,7 @@ ModelMaterial::attributes()
RETVAL = &THIS->_bounding_box;
%};
BoundingBoxf3* bounding_box()
%code%{
RETVAL = new BoundingBoxf3();
THIS->bounding_box(RETVAL);
%};
Clone<BoundingBoxf3> bounding_box();
%name{_add_volume} Ref<ModelVolume> add_volume(TriangleMesh* mesh)
%code%{ RETVAL = THIS->add_volume(*mesh); %};

View file

@ -10,6 +10,6 @@
~MotionPlanner();
int islands_count();
Polyline* shortest_path(Point* from, Point* to)
%code%{ RETVAL = new Polyline(); THIS->shortest_path(*from, *to, RETVAL); %};
Clone<Polyline> shortest_path(Point* from, Point* to)
%code%{ RETVAL = THIS->shortest_path(*from, *to); %};
};

View file

@ -22,9 +22,13 @@
%code{% RETVAL = THIS->x; %};
long y()
%code{% RETVAL = THIS->y; %};
void set_x(long val)
%code{% THIS->x = val; %};
void set_y(long val)
%code{% THIS->y = val; %};
int nearest_point_index(Points points);
Point* nearest_point(Points points)
%code{% RETVAL = new Point(); THIS->nearest_point(points, RETVAL); %};
Clone<Point> nearest_point(Points points)
%code{% Point p; THIS->nearest_point(points, &p); RETVAL = p; %};
double distance_to(Point* point)
%code{% RETVAL = THIS->distance_to(*point); %};
double distance_to_line(Line* line)

View file

@ -19,14 +19,11 @@
void translate(double x, double y);
void reverse();
Lines lines();
Polyline* split_at_vertex(Point* point)
%code{% RETVAL = new Polyline(); THIS->split_at_vertex(*point, RETVAL); %};
Polyline* split_at_index(int index)
%code{% RETVAL = new Polyline(); THIS->split_at_index(index, RETVAL); %};
Polyline* split_at_first_point()
%code{% RETVAL = new Polyline(); THIS->split_at_first_point(RETVAL); %};
Points equally_spaced_points(double distance)
%code{% THIS->equally_spaced_points(distance, &RETVAL); %};
Clone<Polyline> split_at_vertex(Point* point)
%code{% RETVAL = THIS->split_at_vertex(*point); %};
Clone<Polyline> split_at_index(int index);
Clone<Polyline> split_at_first_point();
Points equally_spaced_points(double distance);
double length();
double area();
bool is_counter_clockwise();
@ -41,16 +38,10 @@
Polygons triangulate_convex()
%code{% THIS->triangulate_convex(&RETVAL); %};
Clone<Point> centroid();
BoundingBox* bounding_box()
%code{%
RETVAL = new BoundingBox();
THIS->bounding_box(RETVAL);
%};
Clone<BoundingBox> bounding_box();
std::string wkt();
Points concave_points(double angle)
%code{% THIS->concave_points(angle, &RETVAL); %};
Points convex_points(double angle)
%code{% THIS->convex_points(angle, &RETVAL); %};
Points concave_points(double angle);
Points convex_points(double angle);
%{
Polygon*

View file

@ -23,8 +23,7 @@
Lines lines();
Clone<Point> first_point();
Clone<Point> last_point();
Points equally_spaced_points(double distance)
%code{% THIS->equally_spaced_points(distance, &RETVAL); %};
Points equally_spaced_points(double distance);
double length();
bool is_valid();
void clip_end(double distance);
@ -37,11 +36,8 @@
void split_at(Point* point, Polyline* p1, Polyline* p2)
%code{% THIS->split_at(*point, p1, p2); %};
bool is_straight();
BoundingBox* bounding_box()
%code{%
RETVAL = new BoundingBox();
THIS->bounding_box(RETVAL);
%};
Clone<BoundingBox> bounding_box();
void remove_duplicate_points();
std::string wkt();
%{

View file

@ -35,8 +35,8 @@ _constant()
%code%{ RETVAL = &THIS->config; %};
Ref<Print> print();
Flow* flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
%code%{ RETVAL = new Flow(THIS->flow(role, layer_height, bridge, first_layer, width, *object)); %};
Clone<Flow> flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
%code%{ RETVAL = THIS->flow(role, layer_height, bridge, first_layer, width, *object); %};
};
@ -61,11 +61,7 @@ _constant()
%code%{ RETVAL = THIS->layer_height_ranges; %};
Ref<Point3> size()
%code%{ RETVAL = &THIS->size; %};
BoundingBox* bounding_box()
%code{%
RETVAL = new BoundingBox();
THIS->bounding_box(RETVAL);
%};
Clone<BoundingBox> bounding_box();
Ref<Point> _copies_shift()
%code%{ RETVAL = &THIS->_copies_shift; %};
@ -99,7 +95,7 @@ _constant()
size_t support_layer_count();
void clear_support_layers();
Ref<SupportLayer> get_support_layer(int idx);
Ref<SupportLayer> add_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
Ref<SupportLayer> add_support_layer(int id, coordf_t height, coordf_t print_z);
void delete_support_layer(int idx);
bool invalidate_state_by_config_options(std::vector<std::string> opt_keys);

View file

@ -31,19 +31,11 @@
TriangleMeshPtrs split();
void merge(TriangleMesh* mesh)
%code{% THIS->merge(*mesh); %};
ExPolygons horizontal_projection()
%code{% THIS->horizontal_projection(RETVAL); %};
BoundingBoxf3* bounding_box()
%code{%
RETVAL = new BoundingBoxf3();
THIS->bounding_box(RETVAL);
%};
Pointf3* center()
%code{%
BoundingBoxf3 bb;
THIS->bounding_box(&bb);
RETVAL = new Pointf3(bb.center());
%};
ExPolygons horizontal_projection();
Clone<Polygon> convex_hull();
Clone<BoundingBoxf3> bounding_box();
Clone<Pointf3> center()
%code{% RETVAL = THIS->bounding_box().center(); %};
int facets_count();
void reset_repair_stats();
%{
@ -196,14 +188,6 @@ TriangleMesh::bb3()
OUTPUT:
RETVAL
Polygon*
TriangleMesh::convex_hull()
CODE:
RETVAL = new Polygon ();
THIS->convex_hull(RETVAL);
OUTPUT:
RETVAL
%}
};

View file

@ -186,6 +186,8 @@ BridgeDetector* O_OBJECT_SLIC3R
Ref<BridgeDetector> O_OBJECT_SLIC3R_T
Clone<BridgeDetector> O_OBJECT_SLIC3R_T
GLVertexArray* O_OBJECT_SLIC3R
ExtrusionLoopRole T_UV
ExtrusionRole T_UV
FlowRole T_UV
@ -329,13 +331,11 @@ T_ARRAYREF
if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
AV* av = (AV*)SvRV($arg);
const unsigned int len = av_len(av)+1;
$type* tmp = new $type(len);
$var.resize(len);
for (unsigned int i = 0; i < len; i++) {
SV** elem = av_fetch(av, i, 0);
(*tmp)[i].from_SV_check(*elem);
$var\[i].from_SV_check(*elem);
}
$var = *tmp;
delete tmp;
} else
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
@ -396,6 +396,7 @@ T_STD_STRING
T_STD_VECTOR_STD_STRING
AV* av = newAV();
$arg = newRV_noinc((SV*)av);
sv_2mortal($arg);
const unsigned int len = $var.size();
if (len)
av_extend(av, len-1);
@ -408,6 +409,7 @@ T_STD_VECTOR_STD_STRING
T_STD_VECTOR_INT
AV* av = newAV();
$arg = newRV_noinc((SV*)av);
sv_2mortal($arg);
const unsigned int len = $var.size();
if (len)
av_extend(av, len-1);
@ -418,6 +420,7 @@ T_STD_VECTOR_INT
T_STD_VECTOR_UINT
AV* av = newAV();
$arg = newRV_noinc((SV*)av);
sv_2mortal($arg);
const unsigned int len = $var.size();
if (len)
av_extend(av, len-1);
@ -428,6 +431,7 @@ T_STD_VECTOR_UINT
T_STD_VECTOR_DOUBLE
AV* av = newAV();
$arg = newRV_noinc((SV*)av);
sv_2mortal($arg);
const unsigned int len = $var.size();
if (len)
av_extend(av, len-1);
@ -458,7 +462,6 @@ T_ARRAYREF
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
av_store(av, i++, perl_to_SV_clone_ref(*it));
}
$var.clear();
T_ARRAYREF_PTR
AV* av = newAV();

View file

@ -13,6 +13,7 @@
%typemap{std::vector<unsigned int>*};
%typemap{std::vector<std::string>};
%typemap{t_layer_height_ranges};
%typemap{void*};
%typemap{SV*};
%typemap{AV*};
%typemap{Point*};
@ -167,6 +168,7 @@
%typemap{ModelInstancePtrs*};
%typemap{Ref<ModelInstancePtrs>}{simple};
%typemap{Clone<ModelInstancePtrs>}{simple};
%typemap{GLVertexArray*};
%typemap{PrintRegionPtrs*};
%typemap{PrintObjectPtrs*};