From bed658178e5f6957f26705066b2126136fb831f0 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sun, 18 Jul 2021 09:20:14 +0800 Subject: [PATCH] refactor --- examples/maze/maze_tower.scad | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/examples/maze/maze_tower.scad b/examples/maze/maze_tower.scad index e03ca2f4..3aa47588 100644 --- a/examples/maze/maze_tower.scad +++ b/examples/maze/maze_tower.scad @@ -54,7 +54,7 @@ module maze_tower() { } } - arc(r, [0, 360], wall_thickness); + arc(r, 360, wall_thickness); } module maze_floors() { @@ -78,9 +78,7 @@ module maze_tower() { } last_rows = mz[mz_leng - 1]; i = find_index(last_rows, function(cell) cell[2] == CCW_WALL || cell[2] == INWARD_CCW_WALL); - ci = last_rows[i][1]; - theta1 = outThetaStep * ci; - theta2 = outThetaStep * (ci + 1); + theta1 = outThetaStep * last_rows[i][1]; linear_extrude(wall_height) arc(r * 0.9999, [theta1 + outThetaStep * 0.1, theta1 + outThetaStep * 0.75], wall_thickness); } @@ -88,26 +86,20 @@ module maze_tower() { module d_stairs() { num_stairs = 4; half_wall_thickness = wall_thickness / 2; + stair_thickness = wall_thickness / 3; or = r + half_wall_thickness; for(ri = [0:2:rows * 2]) { for(si = [0:2]) { - r_off = wall_thickness / 3 * si; - r1 = or - wall_thickness / 3 * si - wall_thickness * ri; - r2 = or - wall_thickness / 3 * (si + 1) - wall_thickness * ri; - + r = or - stair_thickness * si - wall_thickness * ri; translate([0, 0, wall_height * ri / 2 + wall_height / num_stairs * (si + 1)]) linear_extrude(wall_height / num_stairs * (3 - si)) - - difference() { - circle(r1); - circle(r2); - } + arc(r, 360, stair_thickness, width_mode = "LINE_INWARD"); } } } difference() { - maze_floors(); + maze_floors(); d_stairs(); } } \ No newline at end of file