Geometry.xsp 2.1 KB

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