Use Clipper for line clipping

This commit is contained in:
Alessandro Ranellucci 2013-11-21 14:15:38 +01:00
parent 1d6a18071a
commit 3025c77675
20 changed files with 202 additions and 211 deletions

View file

@ -91,6 +91,15 @@ diff_ex(subject, clip, safety_offset = false)
OUTPUT:
RETVAL
Polylines
diff_pl(subject, clip)
Polylines subject
Polygons clip
CODE:
diff(subject, clip, RETVAL);
OUTPUT:
RETVAL
Polygons
intersection(subject, clip, safety_offset = false)
Polygons subject
@ -111,6 +120,15 @@ intersection_ex(subject, clip, safety_offset = false)
OUTPUT:
RETVAL
Polylines
intersection_pl(subject, clip)
Polylines subject
Polygons clip
CODE:
intersection(subject, clip, RETVAL);
OUTPUT:
RETVAL
ExPolygons
xor_ex(subject, clip, safety_offset = false)
Polygons subject

View file

@ -25,6 +25,8 @@
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->midpoint(); %};
Point* point_at(double distance)
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->point_at(distance); %};
Polyline* as_polyline()
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = new Polyline(); RETVAL->points.push_back(THIS->a); RETVAL->points.push_back(THIS->b); %};
%{
Line*

View file

@ -17,6 +17,8 @@
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = THIS->chained_path_from(start_near, no_reverse); %};
int count()
%code{% RETVAL = THIS->polylines.size(); %};
Point* leftmost_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->leftmost_point(); %};
%{
PolylineCollection*

View file

@ -22,6 +22,7 @@ ClipperLib::PolyFillType T_UV
Points T_ARRAYREF
Lines T_ARRAYREF
Polygons T_ARRAYREF
Polylines T_ARRAYREF
ExPolygons T_ARRAYREF
# we return these types whenever we want the items to be returned

View file

@ -15,6 +15,7 @@
%typemap{Points};
%typemap{Lines};
%typemap{Polygons};
%typemap{Polylines};
%typemap{ExPolygons};
%typemap{Polygons*};
%typemap{TriangleMeshPtrs};