Clipper.xsp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/ClipperUtils.hpp"
  5. %}
  6. %package{Slic3r::Geometry::Clipper};
  7. %{
  8. IV
  9. _constant()
  10. ALIAS:
  11. JT_MITER = jtMiter
  12. JT_ROUND = jtRound
  13. JT_SQUARE = jtSquare
  14. CODE:
  15. RETVAL = ix;
  16. OUTPUT: RETVAL
  17. Polygons
  18. offset(polygons, delta, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
  19. Polygons polygons
  20. const float delta
  21. Slic3r::ClipperLib::JoinType joinType
  22. double miterLimit
  23. CODE:
  24. RETVAL = offset(polygons, delta, joinType, miterLimit);
  25. OUTPUT:
  26. RETVAL
  27. ExPolygons
  28. offset_ex(polygons, delta, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
  29. Polygons polygons
  30. const float delta
  31. Slic3r::ClipperLib::JoinType joinType
  32. double miterLimit
  33. CODE:
  34. RETVAL = offset_ex(polygons, delta, joinType, miterLimit);
  35. OUTPUT:
  36. RETVAL
  37. ExPolygons
  38. offset2_ex(polygons, delta1, delta2, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
  39. Polygons polygons
  40. const float delta1
  41. const float delta2
  42. Slic3r::ClipperLib::JoinType joinType
  43. double miterLimit
  44. CODE:
  45. RETVAL = offset2_ex(union_ex(polygons), delta1, delta2, joinType, miterLimit);
  46. OUTPUT:
  47. RETVAL
  48. Polygons
  49. diff(subject, clip, safety_offset = false)
  50. Polygons subject
  51. Polygons clip
  52. bool safety_offset
  53. CODE:
  54. RETVAL = diff(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
  55. OUTPUT:
  56. RETVAL
  57. ExPolygons
  58. diff_ex(subject, clip, safety_offset = false)
  59. Polygons subject
  60. Polygons clip
  61. bool safety_offset
  62. CODE:
  63. RETVAL = diff_ex(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
  64. OUTPUT:
  65. RETVAL
  66. Polylines
  67. diff_pl(subject, clip)
  68. Polylines subject
  69. Polygons clip
  70. CODE:
  71. RETVAL = diff_pl(subject, clip);
  72. OUTPUT:
  73. RETVAL
  74. Polygons
  75. intersection(subject, clip, safety_offset = false)
  76. Polygons subject
  77. Polygons clip
  78. bool safety_offset
  79. CODE:
  80. RETVAL = intersection(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
  81. OUTPUT:
  82. RETVAL
  83. ExPolygons
  84. intersection_ex(subject, clip, safety_offset = false)
  85. Polygons subject
  86. Polygons clip
  87. bool safety_offset
  88. CODE:
  89. RETVAL = intersection_ex(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
  90. OUTPUT:
  91. RETVAL
  92. Polylines
  93. intersection_pl(subject, clip)
  94. Polylines subject
  95. Polygons clip
  96. CODE:
  97. RETVAL = intersection_pl(subject, clip);
  98. OUTPUT:
  99. RETVAL
  100. Polygons
  101. union(subject, safety_offset = false)
  102. Polygons subject
  103. bool safety_offset
  104. CODE:
  105. RETVAL = safety_offset ? union_safety_offset(subject) : union_(subject);
  106. OUTPUT:
  107. RETVAL
  108. ExPolygons
  109. union_ex(subject, safety_offset = false)
  110. Polygons subject
  111. bool safety_offset
  112. CODE:
  113. RETVAL = safety_offset ? union_safety_offset_ex(subject) : union_ex(subject);
  114. OUTPUT:
  115. RETVAL
  116. %}