From 88e0876d2fb49449af5ac360c3510049df1e4095 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 12 Feb 2020 20:29:24 +0800 Subject: [PATCH] refactor --- examples/maze/twisted_maze.scad | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/examples/maze/twisted_maze.scad b/examples/maze/twisted_maze.scad index deb7a513..6c08ff15 100644 --- a/examples/maze/twisted_maze.scad +++ b/examples/maze/twisted_maze.scad @@ -1,6 +1,7 @@ use ; use ; use ; +use ; rows = 16; columns = 8; @@ -9,23 +10,11 @@ wall_thickness = 1; angle = 180; // $fn = 24; -function tf_twist(size, p, ) = - function y_twist(walls, angle, rows, columns, block_width) = - let( - x_offset = columns * block_width / 2, - x_centered = [ - for(wall_pts = walls) - [for(pt = wall_pts) [pt[0], pt[1], 0] + [-x_offset, 0, 0]] - ], - a_step = angle / (rows * block_width) - ) + let(size = [columns * block_width, rows * block_width]) [ - for(wall_pts = x_centered) - [ - for(pt = wall_pts) - rotate_p(pt, [0, pt[1] * a_step, 0]) + [x_offset, 0, 0] - ] + for(wall_pts = walls) + [for(pt = wall_pts) tf_y_twist(size, pt, angle)] ]; blocks = go_maze(