mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-14 02:34:12 +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) =
|
||||
threshold < 0 || i == leng ? wf :
|
||||
let(
|
||||
state_weight = states_weights[i],
|
||||
t = threshold - state_weight[1]
|
||||
)
|
||||
_wf_collapse(t < 0 ? _oneStateAt(wf, x, y, state_weight[0]) : wf, x, y, states_weights, leng, t, i + 1);
|
||||
let(state_weight = states_weights[i])
|
||||
_wf_collapse(
|
||||
threshold < state_weight[1] ? _oneStateAt(wf, x, y, state_weight[0]) : wf,
|
||||
x, y, states_weights, leng, threshold - state_weight[1], i + 1
|
||||
);
|
||||
|
||||
function _oneStateAt(wf, x, y, state) = _replaceStatesAt(wf, x, y, [state]);
|
||||
|
||||
|
Reference in New Issue
Block a user