From 044b359bf4f2792b7492cf72c401280f9149e6c4 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 13 Feb 2020 14:14:47 +0800 Subject: [PATCH] refactor --- examples/maze/twisted_maze.scad | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/examples/maze/twisted_maze.scad b/examples/maze/twisted_maze.scad index 6c08ff15..2149e704 100644 --- a/examples/maze/twisted_maze.scad +++ b/examples/maze/twisted_maze.scad @@ -10,20 +10,15 @@ wall_thickness = 1; angle = 180; // $fn = 24; -function y_twist(walls, angle, rows, columns, block_width) = - let(size = [columns * block_width, rows * block_width]) - [ - for(wall_pts = walls) - [for(pt = wall_pts) tf_y_twist(size, pt, angle)] - ]; - blocks = go_maze( 1, 1, // starting point starting_maze(rows, columns), rows, columns ); - walls = maze_walls(blocks, rows, columns, block_width); -for(wall_pts = y_twist(walls, angle, rows, columns, block_width)) { - hull_polyline3d(wall_pts, wall_thickness); + +size = [columns * block_width, rows * block_width]; +for(wall_pts = walls) { + transformed = [for(pt = wall_pts) tf_y_twist(size, pt, angle)]; + hull_polyline3d(transformed, wall_thickness); } \ No newline at end of file