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

refactor: rename

This commit is contained in:
Justin Lin
2022-03-21 15:39:14 +08:00
parent cf1d5deaa9
commit d609292ad2

View File

@@ -33,9 +33,9 @@ function _weights_of_tiles(weights, symbols, leng, i = 0) =
- wf_weights(wf) - wf_weights(wf)
- wf_eigenstates(wf) - wf_eigenstates(wf)
- wf_eigenstates_at(wf, x, y) - wf_eigenstates_at(wf, x, y)
- wf_collapse(wf, x, y) - wf_collapse(wf, x, y, weights)
- wf_entropy(wf, x, y) - wf_entropy_weights(wf, x, y)
- wf_coord_min_entropy(wf, notCollaspedCoords) - wf_coord_weights_min_entropy(wf, notCollaspedCoords)
- wf_not_collapsed_coords(wf, notCollaspedCoords) - wf_not_collapsed_coords(wf, notCollaspedCoords)
*/ */
function wave_function(width, height, weights) = function wave_function(width, height, weights) =
@@ -54,15 +54,15 @@ function wf_weights(wf) = wf[2];
function wf_eigenstates(wf) = wf[3]; function wf_eigenstates(wf) = wf[3];
function wf_eigenstates_at(wf, x, y) = wf_eigenstates(wf)[y][x]; function wf_eigenstates_at(wf, x, y) = wf_eigenstates(wf)[y][x];
function wf_collapse(wf, x, y, wets) = function wf_collapse(wf, x, y, weights) =
let( let(
states = wf_eigenstates_at(wf, x, y), states = wf_eigenstates_at(wf, x, y),
weights = is_undef(wets) ? wets = is_undef(weights) ?
let(all_weights = wf_weights(wf)) [for(state = states) hashmap_get(all_weights, state)] : let(all_weights = wf_weights(wf)) [for(state = states) hashmap_get(all_weights, state)] :
wets, weights,
threshold = rand() * sum(weights) threshold = rand() * sum(wets)
) )
_wf_collapse(wf, x, y, states, weights, len(states), threshold); _wf_collapse(wf, x, y, states, wets, len(states), threshold);
function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) = function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) =
threshold < 0 || i == leng ? wf : threshold < 0 || i == leng ? wf :