From adf07c5da895af3f512626b9cf28dda32f2e38e5 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 6 Apr 2022 17:02:32 +0800 Subject: [PATCH] format --- examples/tiles/tiled_line_ring.scad | 4 ++-- examples/tiles/tiled_line_torus.scad | 7 +++---- examples/tiles/tiled_lines.scad | 7 +++---- examples/tiles/tiled_quarter_circles.scad | 7 +++---- examples/tiles/tiles_wfc_tube.scad | 6 ++---- examples/tiles/tube_box.scad | 7 ++----- examples/voronoi/voronoi_fibonacci2.scad | 15 +++++++-------- examples/voronoi/voronoi_holder.scad | 8 +++----- 8 files changed, 25 insertions(+), 36 deletions(-) diff --git a/examples/tiles/tiled_line_ring.scad b/examples/tiles/tiled_line_ring.scad index eedd4d09..7934b24d 100644 --- a/examples/tiles/tiled_line_ring.scad +++ b/examples/tiles/tiled_line_ring.scad @@ -16,8 +16,8 @@ module tiled_line_ring(radius, height, line_diameter) { lines = [ for(tile = tile_truchet(size)) let( - x = tile[0], - y = tile[1], + x = tile.x, + y = tile.y, i = tile[2] ) if(i <= 1) [ diff --git a/examples/tiles/tiled_line_torus.scad b/examples/tiles/tiled_line_torus.scad index 56f06da8..4c0c412f 100644 --- a/examples/tiles/tiled_line_torus.scad +++ b/examples/tiles/tiled_line_torus.scad @@ -11,11 +11,10 @@ module tiled_line_torus(size, twist, line_diameter = 1) { lines = [ for(tile = tile_truchet(size)) let( - x = tile[0], - y = tile[1], - i = tile[2] + x = tile.x, + y = tile.y ) - i <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]] + tile[2] <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]] ]; half_line_diameter = line_diameter / 2; diff --git a/examples/tiles/tiled_lines.scad b/examples/tiles/tiled_lines.scad index 0021d077..2ab482f8 100644 --- a/examples/tiles/tiled_lines.scad +++ b/examples/tiles/tiled_lines.scad @@ -6,11 +6,10 @@ tile_width = 5; line_width = 1; for(tile = tile_truchet(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; + x = tile.x; + y = tile.y; - if(i <= 1) { + if(tile[2] <= 1) { line2d([x, y] * tile_width , [x + 1, y + 1] * tile_width, width = line_width); } else { diff --git a/examples/tiles/tiled_quarter_circles.scad b/examples/tiles/tiled_quarter_circles.scad index 44b3a6a2..028170da 100644 --- a/examples/tiles/tiled_quarter_circles.scad +++ b/examples/tiles/tiled_quarter_circles.scad @@ -8,10 +8,9 @@ line_width = 1; $fn = 4; // 4, 8, 12 .... for(tile = tile_truchet(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; - if(i <= 1) { + x = tile.x; + y = tile.y; + if(tile[2] <= 1) { translate([x, y] * tile_width) arc(0.5 * tile_width, [0, 90], line_width); translate([x + 1, y + 1] * tile_width) diff --git a/examples/tiles/tiles_wfc_tube.scad b/examples/tiles/tiles_wfc_tube.scad index 2babe99d..b978582f 100644 --- a/examples/tiles/tiles_wfc_tube.scad +++ b/examples/tiles/tiles_wfc_tube.scad @@ -32,11 +32,9 @@ draw_tubes( module draw_tubes(tiles, tileW) { rows = len(tiles); columns = len(tiles[0]); - for(y = [0:rows - 1]) { - for(x = [0:columns - 1]) { - translate([x, rows - y - 1] * tileW) + for(y = [0:rows - 1], x = [0:columns - 1]) { + translate([x, rows - y - 1] * tileW) tube_tile(tiles[y][x], tileW); - } } } diff --git a/examples/tiles/tube_box.scad b/examples/tiles/tube_box.scad index 5d9a99cc..6ac86bd8 100644 --- a/examples/tiles/tube_box.scad +++ b/examples/tiles/tube_box.scad @@ -15,11 +15,8 @@ module tube_box(size, tile_width) { translate([eighth_w, eighth_w, eighth_w] + [tile_width, tile_width, 0] / 2) for(tile = tile_w2e(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; - translate([x, y] * tile_width) - tube_tile(i, tile_width); + translate([tile.x, tile.y] * tile_width) + tube_tile(tile[2], tile_width); } box_extrude(height = tile_width, shell_thickness = eighth_w) diff --git a/examples/voronoi/voronoi_fibonacci2.scad b/examples/voronoi/voronoi_fibonacci2.scad index 5d4891bb..12662b7c 100644 --- a/examples/voronoi/voronoi_fibonacci2.scad +++ b/examples/voronoi/voronoi_fibonacci2.scad @@ -23,17 +23,16 @@ pts_angles = golden_spiral( a_step = 360 / spirals; cells = [ - for(i = [0:spirals - 1]) - for(pt_angle = pts_angles) - ptf_rotate(pt_angle[0], i * a_step) + for(i = [0:spirals - 1], pt_angle = pts_angles) + ptf_rotate(pt_angle[0], i * a_step) ]; noised = [ for(y = [-half_size[1]:pixel_step:half_size[1]]) - [ - for(x = [-half_size[0]:pixel_step:half_size[0]]) - let(n = nz_cell(cells, [x, y] * height_factor) ) - [x, y, n < half_pixel_step ? half_pixel_step : n] - ] + [ + for(x = [-half_size[0]:pixel_step:half_size[0]]) + let(n = nz_cell(cells, [x, y] * height_factor) ) + [x, y, n < half_pixel_step ? half_pixel_step : n] + ] ]; sf_thicken(noised, thickness); \ No newline at end of file diff --git a/examples/voronoi/voronoi_holder.scad b/examples/voronoi/voronoi_holder.scad index 9db51aba..b61b6979 100644 --- a/examples/voronoi/voronoi_holder.scad +++ b/examples/voronoi/voronoi_holder.scad @@ -19,14 +19,12 @@ module voronoi_holder() { difference() { bend_extrude(size = size, thickness = thickness * 3, angle = 360, frags = frags) - render() difference() { square(size); - render() - for(cell = cells) { - offset(-half_spacing) + for(cell = cells) { + offset(-half_spacing) polygon(cell[1]); - } + } } linear_extrude(size[1] - thickness) arc(radius = r, angle = 360, width = thickness, $fn = frags);