Cleanup of some method signatures and of XS return types

This commit is contained in:
Alessandro Ranellucci 2015-01-19 18:53:04 +01:00
parent c9cdae1a96
commit 8791f5a493
39 changed files with 252 additions and 339 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; %};

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

@ -15,8 +15,8 @@
bool make_counter_clockwise();
Clone<Point> first_point();
Clone<Point> last_point();
Polygon* polygon()
%code{% RETVAL = new Polygon (*THIS); %};
Clone<Polygon> polygon()
%code{% RETVAL = Polygon(*THIS); %};
void append(ExtrusionPath* path)
%code{% THIS->paths.push_back(*path); %};
double length();

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

View file

@ -26,8 +26,8 @@
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();
};

View file

@ -28,7 +28,7 @@
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);
Clone<Point> intersection_infinite(Line* other)
%code{%
@ -37,8 +37,8 @@
if (!res) CONFESS("Intersection failed");
RETVAL = p;
%};
Polyline* as_polyline()
%code{% RETVAL = new Polyline(*THIS); %};
Clone<Polyline> as_polyline()
%code{% RETVAL = Polyline(*THIS); %};
Clone<Point> normal();
Clone<Point> vector();
%{

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

@ -27,8 +27,8 @@
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,7 @@
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();
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; %};

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

@ -454,7 +454,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();