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

optimization

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

View File

@@ -62,9 +62,10 @@ function wf_collapse(wf, x, y, weights) =
function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) =
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