1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/examples/maze/maze_city.scad

28 lines
665 B
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <maze/mz_square_initialize.scad>
use <maze/mz_square.scad>
2022-08-10 15:06:22 +08:00
use <maze/mz_tiles.scad>
2022-06-06 13:11:46 +08:00
use <util/rand.scad>
use <../tiles/city_tile.scad>
2021-12-26 18:50:33 +08:00
2021-12-27 09:17:48 +08:00
rows = 10;
columns = 10;
2021-12-26 18:50:33 +08:00
skyscraper_prs = 0.05;
maze_city(rows, columns, skyscraper_prs);
module maze_city(rows, columns, skyscraper_prs) {
mask = [for(r = [0:rows - 1])
[for(c = [0:columns - 1])
rand() < skyscraper_prs ? 0 : 1]
];
cells = mz_square(rows, columns, [0, 0], init_cells = mz_square_initialize(rows, columns, mask));
2022-03-24 14:01:05 +08:00
2022-08-10 15:06:22 +08:00
tiles = mz_tiles(cells);
2022-03-24 14:01:05 +08:00
2021-12-26 18:50:33 +08:00
tile_width = 30;
2021-12-27 09:17:48 +08:00
for(tile = tiles) {
2021-12-27 09:18:47 +08:00
translate([tile.x, tile.y] * tile_width)
city_tile(tile[2], tile_width);
2021-12-26 18:50:33 +08:00
}
}