mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-06 06:47:46 +02:00
rename
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use <maze/mz_square_initialize.scad>
|
use <maze/mz_square_initialize.scad>
|
||||||
use <maze/mz_square.scad>
|
use <maze/mz_square.scad>
|
||||||
use <maze/mz_wang_tiles.scad>
|
use <maze/mz_tiles.scad>
|
||||||
use <util/rand.scad>
|
use <util/rand.scad>
|
||||||
use <../tiles/city_tile.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));
|
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;
|
tile_width = 30;
|
||||||
for(tile = tiles) {
|
for(tile = tiles) {
|
||||||
|
@@ -6,7 +6,7 @@ new:
|
|||||||
|
|
||||||
- triangle/tri_subdivide
|
- triangle/tri_subdivide
|
||||||
|
|
||||||
- maze/mz_wang_tiles?
|
- maze/mz_tiles?
|
||||||
|
|
||||||
- mz_hamiltonian supports init_cells
|
- mz_hamiltonian supports init_cells
|
||||||
|
|
||||||
|
@@ -2,21 +2,21 @@ use <../../util/set/hashset_has.scad>
|
|||||||
|
|
||||||
include <../../__comm__/_pt2_hash.scad>
|
include <../../__comm__/_pt2_hash.scad>
|
||||||
|
|
||||||
function _mz_wang_tiles_top(x, y) =
|
function _mz_tiles_top(x, y) =
|
||||||
let(
|
let(
|
||||||
nx = x * 2,
|
nx = x * 2,
|
||||||
ny = y * 2
|
ny = y * 2
|
||||||
)
|
)
|
||||||
[[nx + 1, ny + 2]];
|
[[nx + 1, ny + 2]];
|
||||||
|
|
||||||
function _mz_wang_tiles_right(x, y) =
|
function _mz_tiles_right(x, y) =
|
||||||
let(
|
let(
|
||||||
nx = x * 2,
|
nx = x * 2,
|
||||||
ny = y * 2
|
ny = y * 2
|
||||||
)
|
)
|
||||||
[[nx + 2, ny + 1]];
|
[[nx + 2, ny + 1]];
|
||||||
|
|
||||||
function _mz_wang_tiles_top_right(x, y) =
|
function _mz_tiles_top_right(x, y) =
|
||||||
let(
|
let(
|
||||||
nx = x * 2,
|
nx = x * 2,
|
||||||
ny = y * 2
|
ny = y * 2
|
||||||
@@ -24,7 +24,7 @@ function _mz_wang_tiles_top_right(x, y) =
|
|||||||
[[nx + 1, ny + 2], [nx + 2, ny + 1]];
|
[[nx + 1, ny + 2], [nx + 2, ny + 1]];
|
||||||
|
|
||||||
hash = function(p) _pt2_hash(p);
|
hash = function(p) _pt2_hash(p);
|
||||||
function _mz_wang_tile_type(dots, x, y) =
|
function _mz_tile_type(dots, x, y) =
|
||||||
let(
|
let(
|
||||||
px = x * 2 + 1,
|
px = x * 2 + 1,
|
||||||
py = y * 2 + 1,
|
py = y * 2 + 1,
|
@@ -1,20 +1,20 @@
|
|||||||
/**
|
/**
|
||||||
* mz_wang_tiles.scad
|
* mz_tiles.scad
|
||||||
*
|
*
|
||||||
* @copyright Justin Lin, 2020
|
* @copyright Justin Lin, 2020
|
||||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
* @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 <mz_square_get.scad>
|
||||||
use <../util/set/hashset.scad>
|
use <../util/set/hashset.scad>
|
||||||
|
|
||||||
include <../__comm__/_pt2_hash.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(
|
let(
|
||||||
rows = len(cells),
|
rows = len(cells),
|
||||||
columns = len(cells[0]),
|
columns = len(cells[0]),
|
||||||
@@ -27,9 +27,9 @@ function mz_wang_tiles(cells, left_border = true, bottom_border = true) =
|
|||||||
x = cell.x,
|
x = cell.x,
|
||||||
y = cell.y,
|
y = cell.y,
|
||||||
type = mz_square_get(cell, "t"),
|
type = mz_square_get(cell, "t"),
|
||||||
pts = type == "TOP_WALL" ? _mz_wang_tiles_top(x, y) :
|
pts = type == "TOP_WALL" ? _mz_tiles_top(x, y) :
|
||||||
type == "RIGHT_WALL" ? _mz_wang_tiles_right(x, y) :
|
type == "RIGHT_WALL" ? _mz_tiles_right(x, y) :
|
||||||
type == "TOP_RIGHT_WALL" || type == "MASK" ? _mz_wang_tiles_top_right(x, y) : []
|
type == "TOP_RIGHT_WALL" || type == "MASK" ? _mz_tiles_top_right(x, y) : []
|
||||||
)
|
)
|
||||||
each pts
|
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])
|
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)]
|
||||||
];
|
];
|
Reference in New Issue
Block a user