Geometry.xsp 2.2 KB

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