1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-06 06:47:46 +02:00
This commit is contained in:
Justin Lin
2022-08-10 15:06:22 +08:00
parent 232a2a56bf
commit 04e089613a
4 changed files with 15 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
use <maze/mz_square_initialize.scad>
use <maze/mz_square.scad>
use <maze/mz_wang_tiles.scad>
use <maze/mz_tiles.scad>
use <util/rand.scad>
use <../tiles/city_tile.scad>
@@ -18,7 +18,7 @@ module maze_city(rows, columns, skyscraper_prs) {
cells = mz_square(rows, columns, [0, 0], init_cells = mz_square_initialize(rows, columns, mask));
tiles = mz_wang_tiles(cells);
tiles = mz_tiles(cells);
tile_width = 30;
for(tile = tiles) {

View File

@@ -6,7 +6,7 @@ new:
- triangle/tri_subdivide
- maze/mz_wang_tiles?
- maze/mz_tiles?
- mz_hamiltonian supports init_cells

View File

@@ -2,21 +2,21 @@ use <../../util/set/hashset_has.scad>
include <../../__comm__/_pt2_hash.scad>
function _mz_wang_tiles_top(x, y) =
function _mz_tiles_top(x, y) =
let(
nx = x * 2,
ny = y * 2
)
[[nx + 1, ny + 2]];
function _mz_wang_tiles_right(x, y) =
function _mz_tiles_right(x, y) =
let(
nx = x * 2,
ny = y * 2
)
[[nx + 2, ny + 1]];
function _mz_wang_tiles_top_right(x, y) =
function _mz_tiles_top_right(x, y) =
let(
nx = x * 2,
ny = y * 2
@@ -24,7 +24,7 @@ function _mz_wang_tiles_top_right(x, y) =
[[nx + 1, ny + 2], [nx + 2, ny + 1]];
hash = function(p) _pt2_hash(p);
function _mz_wang_tile_type(dots, x, y) =
function _mz_tile_type(dots, x, y) =
let(
px = x * 2 + 1,
py = y * 2 + 1,

View File

@@ -1,20 +1,20 @@
/**
* mz_wang_tiles.scad
* mz_tiles.scad
*
* @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_wang_tiles.html
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_tiles.html
*
**/
use <_impl/_mz_wang_tiles_impl.scad>
use <_impl/_mz_tiles_impl.scad>
use <mz_square_get.scad>
use <../util/set/hashset.scad>
include <../__comm__/_pt2_hash.scad>
function mz_wang_tiles(cells, left_border = true, bottom_border = true) =
function mz_tiles(cells, left_border = true, bottom_border = true) =
let(
rows = len(cells),
columns = len(cells[0]),
@@ -27,9 +27,9 @@ function mz_wang_tiles(cells, left_border = true, bottom_border = true) =
x = cell.x,
y = cell.y,
type = mz_square_get(cell, "t"),
pts = type == "TOP_WALL" ? _mz_wang_tiles_top(x, y) :
type == "RIGHT_WALL" ? _mz_wang_tiles_right(x, y) :
type == "TOP_RIGHT_WALL" || type == "MASK" ? _mz_wang_tiles_top_right(x, y) : []
pts = type == "TOP_WALL" ? _mz_tiles_top(x, y) :
type == "RIGHT_WALL" ? _mz_tiles_right(x, y) :
type == "TOP_RIGHT_WALL" || type == "MASK" ? _mz_tiles_top_right(x, y) : []
)
each pts
],
@@ -48,5 +48,5 @@ function mz_wang_tiles(cells, left_border = true, bottom_border = true) =
)
[
for(y = [0:rows - 1], x = [0:columns - 1])
[x, y, _mz_wang_tile_type(dot_pts, x, y)]
[x, y, _mz_tile_type(dot_pts, x, y)]
];