From 26cbffdcdadaeda4c5916819a659c9eccdf3f12b Mon Sep 17 00:00:00 2001 From: Alexandre B A Villares <3694604+villares@users.noreply.github.com> Date: Mon, 28 Dec 2020 19:41:57 -0300 Subject: [PATCH] Update sketch_2020_12_26c_recursive_grid.pyde --- .../sketch_2020_12_26c_recursive_grid.pyde | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/2020/sketch_2020_12_26c_recursive_grid/sketch_2020_12_26c_recursive_grid.pyde b/2020/sketch_2020_12_26c_recursive_grid/sketch_2020_12_26c_recursive_grid.pyde index b6fb4cb3..06d64b22 100644 --- a/2020/sketch_2020_12_26c_recursive_grid/sketch_2020_12_26c_recursive_grid.pyde +++ b/2020/sketch_2020_12_26c_recursive_grid/sketch_2020_12_26c_recursive_grid.pyde @@ -3,8 +3,6 @@ from villares import ubuntu_jogl_fix # you probably won't need this from copy import deepcopy -ox, oy = 0, 0 - def setup(): global grid, other_grid size(640, 640, P3D) @@ -105,29 +103,20 @@ def check_valid_cells(cells): return all(cell[-1] is None and cell[-2] == cw for cell in cells) - -def otranslate(x, y): - global ox, oy - ox += x - oy += y - def rec_grid(x, y, n, tw, shallow=None): - otranslate(x, y) cw = float(tw) / n margin = (cw - tw) / 2.0 cells = [] for i in range(n): - nx = cw * i + margin + nx = x + cw * i + margin for j in range(n): - ny = cw * j + margin + ny = y + cw * j + margin if cw > 8 and random(10) < 5 and not shallow: cs = rec_grid(nx, ny, 2, cw) cells.append(cs) else: - cells.append((ox + nx, - oy + ny, + cells.append((nx, ny, cw - 2, None)) - otranslate(-x, -y) return cells