mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-15 03:05:41 +02:00
refactor: just test threshold < state_weight[1]
This commit is contained in:
@@ -84,11 +84,11 @@ function wf_collapse(wf, x, y) =
|
|||||||
|
|
||||||
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 :
|
||||||
let(
|
let(state_weight = states_weights[i])
|
||||||
state_weight = states_weights[i],
|
_wf_collapse(
|
||||||
t = threshold - state_weight[1]
|
threshold < state_weight[1] ? _oneStateAt(wf, x, y, state_weight[0]) : wf,
|
||||||
)
|
x, y, states_weights, leng, threshold - state_weight[1], i + 1
|
||||||
_wf_collapse(t < 0 ? _oneStateAt(wf, x, y, state_weight[0]) : wf, x, y, states_weights, leng, t, i + 1);
|
);
|
||||||
|
|
||||||
function _oneStateAt(wf, x, y, state) = _replaceStatesAt(wf, x, y, [state]);
|
function _oneStateAt(wf, x, y, state) = _replaceStatesAt(wf, x, y, [state]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user