mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-10 00:36:40 +02:00
refactor: del tilemap
This commit is contained in:
@@ -116,26 +116,6 @@ function _coord_entropy_weights(coord_entropy_weights_lt, leng, m, i = 1) =
|
|||||||
i == leng ? m :
|
i == leng ? m :
|
||||||
let(cm = coord_entropy_weights_lt[i])
|
let(cm = coord_entropy_weights_lt[i])
|
||||||
_coord_entropy_weights(coord_entropy_weights_lt, leng, m[2][0] <= cm[2][0] ? m : cm, i + 1);
|
_coord_entropy_weights(coord_entropy_weights_lt, leng, m[2][0] <= cm[2][0] ? m : cm, i + 1);
|
||||||
|
|
||||||
/*
|
|
||||||
- tilemap(width, height, sample)
|
|
||||||
- tilemap_width(tm)
|
|
||||||
- tilemap_height(tm)
|
|
||||||
- tilemap_compatibilities(tm)
|
|
||||||
- tilemap_wf(tm)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function tilemap(width, height, sample) = [
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
compatibilities_of_tiles(sample),
|
|
||||||
wave_function(width, height, weights_of_tiles(sample))
|
|
||||||
];
|
|
||||||
|
|
||||||
function tilemap_width(tm) = tm[0];
|
|
||||||
function tilemap_height(tm) = tm[1];
|
|
||||||
function tilemap_compatibilities(tm) = tm[2];
|
|
||||||
function tilemap_wf(tm) = tm[3];
|
|
||||||
|
|
||||||
function propagate(nbr_dirs, compatibilities, wf, coord) =
|
function propagate(nbr_dirs, compatibilities, wf, coord) =
|
||||||
_propagate(
|
_propagate(
|
||||||
|
@@ -10,12 +10,11 @@ function tile_wfc(size, sample) =
|
|||||||
for(y = [0:h - 1])
|
for(y = [0:h - 1])
|
||||||
[for(x = [0:w - 1]) neighbor_dirs(x, y, w, h)]
|
[for(x = [0:w - 1]) neighbor_dirs(x, y, w, h)]
|
||||||
],
|
],
|
||||||
tm = tilemap(w, h, sample),
|
|
||||||
// random start
|
// random start
|
||||||
x = floor(rand(w * 0.25, w * 0.75)),
|
x = floor(rand(w * 0.25, w * 0.75)),
|
||||||
y = floor(rand(h * 0.25, h * 0.75)),
|
y = floor(rand(h * 0.25, h * 0.75)),
|
||||||
compatibilities = tilemap_compatibilities(tm),
|
compatibilities = compatibilities_of_tiles(sample),
|
||||||
wf = tilemap_wf(tm),
|
wf = wave_function(w, h, weights_of_tiles(sample)),
|
||||||
all_weights = wf_weights(wf),
|
all_weights = wf_weights(wf),
|
||||||
states = wf_eigenstates_at(wf, x, y),
|
states = wf_eigenstates_at(wf, x, y),
|
||||||
weights = [for(state = states) get_state_weight(all_weights, state)],
|
weights = [for(state = states) get_state_weight(all_weights, state)],
|
||||||
|
Reference in New Issue
Block a user