pattern.scad 926 B

1234567891011121314151617181920212223242526272829303132333435
  1. include <../config/pattern.scad>
  2. module pattern(width, height) {
  3. module single() {
  4. move_x = pattern_size_x / 2 - pattern_width / 2;
  5. move_y = pattern_size_y / 2 - pattern_width / 2;
  6. hull() {
  7. translate([-move_x, move_y]) {
  8. circle(d = pattern_width);
  9. }
  10. translate([move_x, -move_y]) {
  11. circle(d = pattern_width);
  12. }
  13. }
  14. }
  15. move_x = pattern_size_x + pattern_space_x;
  16. move_y = pattern_size_y + pattern_space_y;
  17. abs_width = width - (width % move_x);
  18. abs_height = height - (height % move_y);
  19. corner_x = abs_width / 2 - move_x / 2;
  20. corner_y = abs_height / 2 - move_y / 2;
  21. for (count_x = [-corner_x : move_x : corner_x]) {
  22. for (count_y = [-corner_y : move_y : corner_y]) {
  23. translate([count_x, count_y]) {
  24. single();
  25. }
  26. }
  27. }
  28. }