1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-09 16:26:47 +02:00

refactor: del tilemap

This commit is contained in:
Justin Lin
2022-04-19 13:26:26 +08:00
parent fa65d0687b
commit ca6394bb19
2 changed files with 2 additions and 23 deletions

View File

@@ -117,26 +117,6 @@ function _coord_entropy_weights(coord_entropy_weights_lt, leng, m, i = 1) =
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);
/*
- 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) =
_propagate(
nbr_dirs,

View File

@@ -10,12 +10,11 @@ function tile_wfc(size, sample) =
for(y = [0:h - 1])
[for(x = [0:w - 1]) neighbor_dirs(x, y, w, h)]
],
tm = tilemap(w, h, sample),
// random start
x = floor(rand(w * 0.25, w * 0.75)),
y = floor(rand(h * 0.25, h * 0.75)),
compatibilities = tilemap_compatibilities(tm),
wf = tilemap_wf(tm),
compatibilities = compatibilities_of_tiles(sample),
wf = wave_function(w, h, weights_of_tiles(sample)),
all_weights = wf_weights(wf),
states = wf_eigenstates_at(wf, x, y),
weights = [for(state = states) get_state_weight(all_weights, state)],