From 3784469c59250a7f72e08da5601319f9e9479bfd Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 31 Jul 2021 16:23:26 +0800 Subject: [PATCH] refactor --- examples/tiles/tiles_wfc_tube.scad | 39 ++++++------------------------ 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/examples/tiles/tiles_wfc_tube.scad b/examples/tiles/tiles_wfc_tube.scad index 3a0fd265..e21ff9b9 100644 --- a/examples/tiles/tiles_wfc_tube.scad +++ b/examples/tiles/tiles_wfc_tube.scad @@ -1,4 +1,5 @@ use ; +use ; sample = [ [ 6, 12, 0, 0, 0, 0, 0, 0, 0, 6, 12], @@ -104,53 +105,27 @@ module tube_tile(n, width) { rotate(90) tile5(); } + + module tile0() { + // nope + } - if(n == 0) { - // no tube - } - else if(n == 1) { + select(n) { + tile0(); tile1(); - } - else if(n == 2) { rotate(-90) tile1(); - } - else if(n == 3) { tile3(); - } - else if(n == 4) { rotate(-180) tile1(); - } - else if(n == 5) { tile5(); - } - else if(n == 6) { rotate(-90) tile3(); - } - else if(n == 7) { tile7(); - } - else if(n == 8) { rotate(90) tile1(); - } - else if(n == 9) { rotate(90) tile3(); - } - else if(n == 10) { rotate(90) tile5(); - } - else if(n == 11) { rotate(90) tile7(); - } - else if(n == 12) { rotate(-180) tile3(); - } - else if(n == 13) { rotate(180) tile7(); - } - else if(n == 14) { rotate(270) tile7(); - } - else if(n == 15) { tile15(); } } \ No newline at end of file