mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 14:04:53 +02:00
refactor
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
use <experimental/2_edge_wang_tiles.scad>;
|
||||||
use <arc.scad>;
|
use <arc.scad>;
|
||||||
|
|
||||||
rows = 10;
|
rows = 10;
|
||||||
@@ -6,28 +7,7 @@ tile_width = 10;
|
|||||||
tile_thickness = 2;
|
tile_thickness = 2;
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
|
|
||||||
module two_edge_wang_tiles(rows, columns, tile_width) {
|
2_edge_wang_tiles(rows, columns, tile_width) {
|
||||||
edges = [
|
|
||||||
for(y = [0:rows])
|
|
||||||
[
|
|
||||||
for(x = [0:columns])
|
|
||||||
[round(rands(0, 1, 1)[0]), round(rands(0, 1, 1)[0])]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
for(y = [0:rows - 1]) {
|
|
||||||
for(x = [0:columns - 1]) {
|
|
||||||
i = (edges[y + 1][x][0] == 1 ? 1 : 0) +
|
|
||||||
(edges[y][x + 1][1] == 1 ? 2 : 0) +
|
|
||||||
(edges[y][x][0] == 1 ? 4 : 0) +
|
|
||||||
(edges[y][x][1] == 1 ? 8 : 0);
|
|
||||||
translate([x, y] * tile_width)
|
|
||||||
children(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
two_edge_wang_tiles(rows, columns, tile_width) {
|
|
||||||
sample_tile(0, tile_width, tile_thickness);
|
sample_tile(0, tile_width, tile_thickness);
|
||||||
sample_tile(1, tile_width, tile_thickness);
|
sample_tile(1, tile_width, tile_thickness);
|
||||||
sample_tile(2, tile_width, tile_thickness);
|
sample_tile(2, tile_width, tile_thickness);
|
||||||
@@ -54,7 +34,7 @@ translate([0, tile_width * (rows + 1)]) {
|
|||||||
|
|
||||||
color("green")
|
color("green")
|
||||||
linear_extrude(tile_thickness)
|
linear_extrude(tile_thickness)
|
||||||
two_edge_wang_tiles(rows, columns, tile_width) {
|
2_edge_wang_tiles(rows, columns, tile_width) {
|
||||||
path_tile(0, tile_width);
|
path_tile(0, tile_width);
|
||||||
path_tile(1, tile_width);
|
path_tile(1, tile_width);
|
||||||
path_tile(2, tile_width);
|
path_tile(2, tile_width);
|
Reference in New Issue
Block a user