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

optimization

This commit is contained in:
Justin Lin
2022-04-19 13:33:34 +08:00
parent ca6394bb19
commit 68f73a808a

View File

@@ -61,10 +61,11 @@ function wf_collapse(wf, x, y, weights) =
_wf_collapse(wf, x, y, states, weights, len(states), threshold);
function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) =
threshold < 0 || i == leng ? wf :
threshold < 0 || i == leng ? wf :
let(weight = weights[i])
_wf_collapse(
threshold < weights[i] ? _replaceStatesAt(wf, x, y, [states[i]]) : wf,
x, y, states, weights, leng, threshold - weights[i], i + 1
threshold < weight ? _replaceStatesAt(wf, x, y, [states[i]]) : wf,
x, y, states, weights, leng, threshold - weight, i + 1
);
// Shannon entropy