Clipper.xsp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "clipper.hpp"
  5. #include "libslic3r/ClipperUtils.hpp"
  6. %}
  7. %package{Slic3r::Geometry::Clipper};
  8. Polygons offset(Polygons polygons, float delta, double scale = CLIPPER_OFFSET_SCALE,
  9. ClipperLib::JoinType joinType = ClipperLib::jtMiter, double miterLimit = 3);
  10. ExPolygons offset_ex(Polygons polygons, float delta, double scale = CLIPPER_OFFSET_SCALE,
  11. ClipperLib::JoinType joinType = ClipperLib::jtMiter, double miterLimit = 3);
  12. Polygons offset2(Polygons polygons, float delta1, float delta2, double scale = CLIPPER_OFFSET_SCALE,
  13. ClipperLib::JoinType joinType = ClipperLib::jtMiter, double miterLimit = 3);
  14. ExPolygons offset2_ex(Polygons polygons, float delta1, float delta2, double scale = CLIPPER_OFFSET_SCALE,
  15. ClipperLib::JoinType joinType = ClipperLib::jtMiter, double miterLimit = 3);
  16. Polygons diff(Polygons subject, Polygons clip, bool safety_offset = false);
  17. ExPolygons diff_ex(Polygons subject, Polygons clip, bool safety_offset = false);
  18. Polylines diff_pl(Polylines subject, Polygons clip);
  19. Polygons intersection(Polygons subject, Polygons clip, bool safety_offset = false);
  20. ExPolygons intersection_ex(Polygons subject, Polygons clip, bool safety_offset = false);
  21. Polylines intersection_pl(Polylines subject, Polygons clip);
  22. %name{intersection_ppl} Polylines intersection_pl(Polygons subject, Polygons clip);
  23. %name{union} Polygons union_(Polygons subject, bool safety_offset = false);
  24. ExPolygons union_ex(Polygons subject, bool safety_offset = false);
  25. Polygons union_pt_chained(Polygons subject, bool safety_offset = false);
  26. Polygons simplify_polygons(Polygons subject);
  27. %{
  28. IV
  29. _constant()
  30. ALIAS:
  31. JT_MITER = jtMiter
  32. JT_ROUND = jtRound
  33. JT_SQUARE = jtSquare
  34. CLIPPER_OFFSET_SCALE = CLIPPER_OFFSET_SCALE
  35. CODE:
  36. RETVAL = ix;
  37. OUTPUT: RETVAL
  38. SV*
  39. union_pt(subject, safety_offset = false)
  40. Polygons subject
  41. bool safety_offset
  42. CODE:
  43. // perform operation
  44. ClipperLib::PolyTree polytree = union_pt(subject, safety_offset);
  45. RETVAL = polynode_children_2_perl(polytree);
  46. OUTPUT:
  47. RETVAL
  48. %}