diff --git a/examples/hollow_out/hollow_out_holder.scad b/examples/hollow_out/hollow_out_holder.scad index 742ae01c..c2326d89 100644 --- a/examples/hollow_out/hollow_out_holder.scad +++ b/examples/hollow_out/hollow_out_holder.scad @@ -1,7 +1,6 @@ use ; -use ; -use ; use ; +use ; width = 5; columns = 30; @@ -9,35 +8,6 @@ rows = 15; radius = 30; angle = 360; thickness = 2; - -function h_lines_in_square(width) = - let( - w = width / 2, - i = ceil(rand() * 10) % 2, - tris = i == 0 ? - [ - [[0, 0], [width, 0], [width, width]], - [[0, 0], [width, width], [0, width]] - ] - : - [ - [[width, 0], [0, width], [0, 0]], - [[width, 0], [width, width], [0, width]] - ] - ) - concat(tri_bisectors(tris[0]), tri_bisectors(tris[1])); - -function hollow_out_square(size, width) = - let( - columns = size[0], - rows = size[1] - ) - [ - for(y = [0:width:width * rows - width]) - for(x = [0:width:width * columns - width]) - for(line = h_lines_in_square(width)) - [for(p = line) p + [x, y]] - ]; lines = concat( hollow_out_square([columns, rows], width), diff --git a/examples/hollow_out/hollow_out_square.scad b/examples/hollow_out/hollow_out_square.scad new file mode 100644 index 00000000..dd75cb56 --- /dev/null +++ b/examples/hollow_out/hollow_out_square.scad @@ -0,0 +1,31 @@ +use ; +use ; + +function h_lines_in_square(width) = + let( + w = width / 2, + i = ceil(rand() * 10) % 2, + tris = i == 0 ? + [ + [[0, 0], [width, 0], [width, width]], + [[0, 0], [width, width], [0, width]] + ] + : + [ + [[width, 0], [0, width], [0, 0]], + [[width, 0], [width, width], [0, width]] + ] + ) + concat(tri_bisectors(tris[0]), tri_bisectors(tris[1])); + +function hollow_out_square(size, width) = + let( + columns = size[0], + rows = size[1] + ) + [ + for(y = [0:width:width * rows - width]) + for(x = [0:width:width * columns - width]) + for(line = h_lines_in_square(width)) + [for(p = line) p + [x, y]] + ]; \ No newline at end of file