Geometry.xsp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/Geometry.hpp"
  5. %}
  6. %package{Slic3r::Geometry};
  7. Pointfs arrange(size_t total_parts, Vec2d* part, coordf_t dist, BoundingBoxf* bb = NULL)
  8. %code{%
  9. Pointfs points;
  10. if (! Slic3r::Geometry::arrange(total_parts, *part, dist, bb, points))
  11. CONFESS(PRINTF_ZU " parts won't fit in your print area!\n", total_parts);
  12. RETVAL = points;
  13. %};
  14. %{
  15. bool
  16. directions_parallel(angle1, angle2)
  17. double angle1
  18. double angle2
  19. CODE:
  20. RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2);
  21. OUTPUT:
  22. RETVAL
  23. bool
  24. directions_parallel_within(angle1, angle2, max_diff)
  25. double angle1
  26. double angle2
  27. double max_diff
  28. CODE:
  29. RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2, max_diff);
  30. OUTPUT:
  31. RETVAL
  32. Clone<Polygon>
  33. convex_hull(points)
  34. Points points
  35. CODE:
  36. RETVAL = Slic3r::Geometry::convex_hull(points);
  37. OUTPUT:
  38. RETVAL
  39. std::vector<Points::size_type>
  40. chained_path(points)
  41. Points points
  42. CODE:
  43. Slic3r::Geometry::chained_path(points, RETVAL);
  44. OUTPUT:
  45. RETVAL
  46. std::vector<Points::size_type>
  47. chained_path_from(points, start_from)
  48. Points points
  49. Point* start_from
  50. CODE:
  51. Slic3r::Geometry::chained_path(points, RETVAL, *start_from);
  52. OUTPUT:
  53. RETVAL
  54. double
  55. rad2deg(angle)
  56. double angle
  57. CODE:
  58. RETVAL = Slic3r::Geometry::rad2deg(angle);
  59. OUTPUT:
  60. RETVAL
  61. double
  62. rad2deg_dir(angle)
  63. double angle
  64. CODE:
  65. RETVAL = Slic3r::Geometry::rad2deg_dir(angle);
  66. OUTPUT:
  67. RETVAL
  68. double
  69. deg2rad(angle)
  70. double angle
  71. CODE:
  72. RETVAL = Slic3r::Geometry::deg2rad(angle);
  73. OUTPUT:
  74. RETVAL
  75. Polygons
  76. simplify_polygons(polygons, tolerance)
  77. Polygons polygons
  78. double tolerance
  79. CODE:
  80. Slic3r::Geometry::simplify_polygons(polygons, tolerance, &RETVAL);
  81. OUTPUT:
  82. RETVAL
  83. IV
  84. _constant()
  85. ALIAS:
  86. X = X
  87. Y = Y
  88. Z = Z
  89. PROTOTYPE:
  90. CODE:
  91. RETVAL = ix;
  92. OUTPUT: RETVAL
  93. %}