2022-06-06 13:11:46 +08:00
|
|
|
use <experimental/tile_truchet.scad>
|
|
|
|
use <arc.scad>
|
|
|
|
use <line2d.scad>
|
|
|
|
use <select.scad>
|
2021-07-31 12:32:30 +08:00
|
|
|
|
|
|
|
size = [50, 25];
|
|
|
|
tile_width = 5;
|
|
|
|
line_width = 1;
|
|
|
|
|
|
|
|
$fn = 12; // 4, 8, 12 ....
|
|
|
|
|
|
|
|
for(tile = tile_truchet(size)) {
|
2022-04-06 12:11:38 +08:00
|
|
|
translate([tile.x, tile.y] * tile_width)
|
|
|
|
select(tile[2]) {
|
2021-07-31 16:19:40 +08:00
|
|
|
tile00(tile_width, line_width);
|
|
|
|
tile01(tile_width, line_width);
|
|
|
|
tile02(tile_width, line_width);
|
|
|
|
tile03(tile_width, line_width);
|
2021-07-31 12:32:30 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-07-31 16:19:40 +08:00
|
|
|
module tile00(tile_width, line_width) {
|
2021-07-31 16:16:58 +08:00
|
|
|
arc(0.5 * tile_width, [0, 90], line_width);
|
|
|
|
translate([tile_width, tile_width])
|
2021-07-31 12:32:30 +08:00
|
|
|
arc(0.5 * tile_width, [180, 270], line_width);
|
|
|
|
}
|
|
|
|
|
2021-07-31 16:19:40 +08:00
|
|
|
module tile01(tile_width, line_width) {
|
2021-07-31 16:16:58 +08:00
|
|
|
translate([0, tile_width])
|
2021-07-31 12:32:30 +08:00
|
|
|
arc(0.5 * tile_width, [270, 360], line_width);
|
2021-07-31 16:16:58 +08:00
|
|
|
translate([tile_width, 0])
|
2021-07-31 12:32:30 +08:00
|
|
|
arc(0.5 * tile_width, [90, 180], line_width);
|
|
|
|
}
|
|
|
|
|
2021-07-31 16:19:40 +08:00
|
|
|
module tile02(tile_width, line_width) {
|
2021-07-31 12:32:30 +08:00
|
|
|
half_width = tile_width * 0.5;
|
2021-07-31 16:16:58 +08:00
|
|
|
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");
|
2021-07-31 12:32:30 +08:00
|
|
|
}
|
|
|
|
|
2021-07-31 16:19:40 +08:00
|
|
|
module tile03(tile_width, line_width) {
|
2021-07-31 12:32:30 +08:00
|
|
|
half_width = tile_width * 0.5;
|
2021-07-31 16:16:58 +08:00
|
|
|
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");
|
2021-07-31 12:32:30 +08:00
|
|
|
}
|