1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-07-31 20:10:36 +02:00

rename and refactor

This commit is contained in:
Justin Lin
2021-07-31 16:16:58 +08:00
parent 3b48de2c47
commit 0a117e0c09
8 changed files with 30 additions and 37 deletions

View File

@@ -1,6 +1,5 @@
use <experimental/tile_w2c.scad>;
use <arc.scad>;
use <experimental/choose_children.scad>;
size = [15, 10];
tile_width = 10;

View File

@@ -1,5 +1,5 @@
use <experimental/tile_w2e.scad>;
use <experimental/choose_children.scad>;
use <experimental/select.scad>;
use <arc.scad>;
size = [15, 10];
@@ -125,7 +125,7 @@ module path_tile(n, width) {
}
}
choose_children(n) {
select(n) {
square(width, center = true);
tile1();
rotate(-90) tile1();

View File

@@ -1,6 +1,6 @@
use <line2d.scad>;
use <experimental/tile_hitomezashi.scad>;
use <experimental/choose_children.scad>;
use <experimental/select.scad>;
size = [50, 25];
tile_width = 5;
@@ -10,7 +10,9 @@ for(tile = tile_hitomezashi(size)) {
x = tile[0];
y = tile[1];
i = tile[2];
choose_children(i) {
translate([x, y] * tile_width)
select(i) {
tile00(x, y, tile_width, line_width);
tile01(x, y, tile_width, line_width);
tile02(x, y, tile_width, line_width);
@@ -24,20 +26,16 @@ module tile00(x, y, tile_width, line_width) {
// _
module tile01(x, y, tile_width, line_width) {
translate([x, y] * tile_width)
line2d([0, 0], [tile_width, 0], line_width);
line2d([0, 0], [tile_width, 0], line_width);
}
// |_
module tile02(x, y, tile_width, line_width) {
translate([x, y] * tile_width)
line2d([0, 0], [0, tile_width], line_width);
line2d([0, 0], [0, tile_width], line_width);
}
// |
module tile03(x, y, tile_width, line_width) {
translate([x, y] * tile_width) {
line2d([0, 0], [0, tile_width], line_width);
line2d([0, 0], [tile_width, 0], line_width);
}
line2d([0, 0], [0, tile_width], line_width);
line2d([0, 0], [tile_width, 0], line_width);
}

View File

@@ -1,7 +1,7 @@
use <experimental/tile_truchet.scad>;
use <arc.scad>;
use <line2d.scad>;
use <experimental/choose_children.scad>;
use <experimental/select.scad>;
size = [50, 25];
tile_width = 5;
@@ -14,7 +14,8 @@ for(tile = tile_truchet(size)) {
y = tile[1];
i = tile[2];
choose_children(i) {
translate([x, y] * tile_width)
select(i) {
tile00(x, y, tile_width, line_width);
tile01(x, y, tile_width, line_width);
tile02(x, y, tile_width, line_width);
@@ -23,33 +24,28 @@ for(tile = tile_truchet(size)) {
}
module tile00(x, y, tile_width, line_width) {
translate([x, y] * tile_width)
arc(0.5 * tile_width, [0, 90], line_width);
translate([x + 1, y + 1] * tile_width)
arc(0.5 * tile_width, [0, 90], line_width);
translate([tile_width, tile_width])
arc(0.5 * tile_width, [180, 270], line_width);
}
module tile01(x, y, tile_width, line_width) {
translate([x, y + 1] * tile_width)
translate([0, tile_width])
arc(0.5 * tile_width, [270, 360], line_width);
translate([x + 1, y] * tile_width)
translate([tile_width, 0])
arc(0.5 * tile_width, [90, 180], line_width);
}
module tile02(x, y, tile_width, line_width) {
half_width = tile_width * 0.5;
translate([x, y] * tile_width) {
line2d([half_width, 0], [half_width, tile_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([0, half_width], [half_width - line_width, half_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([half_width + line_width, half_width], [tile_width, half_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
}
line2d([half_width, 0], [half_width, tile_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([0, half_width], [half_width - line_width, half_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([half_width + line_width, half_width], [tile_width, half_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
}
module tile03(x, y, tile_width, line_width) {
half_width = tile_width * 0.5;
translate([x, y] * tile_width) {
line2d([0, half_width], [tile_width, half_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([half_width, 0], [half_width, half_width - line_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([half_width, tile_width], [half_width, half_width + line_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
}
line2d([0, half_width], [tile_width, half_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([half_width, 0], [half_width, half_width - line_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
line2d([half_width, tile_width], [half_width, half_width + line_width], line_width, p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
}

View File

@@ -4,7 +4,7 @@ use <arc.scad>;
use <shear.scad>;
use <util/rand.scad>;
use <experimental/tile_w2e.scad>;
use <experimental/choose_children.scad>;
use <experimental/select.scad>;
mask = [
[0, 1, 1, 0, 0, 0, 1, 1, 0],
@@ -31,7 +31,7 @@ module random_city(rows, columns, mask) {
y = tile[1];
i = tile[2];
translate([x, y] * tile_width)
choose_children(i) {
select(i) {
tile00();
tile01();
tile02();

View File

@@ -1,5 +1,5 @@
use <experimental/tile_w2e.scad>;
use <experimental/choose_children.scad>;
use <experimental/select.scad>;
use <box_extrude.scad>;
size = [15, 8];
@@ -112,7 +112,7 @@ module tube_tile(n, width) {
tile5();
}
choose_children(n) {
select(n) {
tile0();
tile1();
rotate(-90) tile1();

View File

@@ -1,3 +0,0 @@
module choose_children(n) {
children(n);
}

View File

@@ -0,0 +1,3 @@
module select(n) {
children(n);
}