mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-15 03:05:41 +02:00
performance improved
This commit is contained in:
@@ -78,10 +78,11 @@ function wf_collapse(wf, x, y) =
|
|||||||
weights = wf_weights(wf),
|
weights = wf_weights(wf),
|
||||||
states_xy = wf_eigenstates_at(wf, x, y),
|
states_xy = wf_eigenstates_at(wf, x, y),
|
||||||
weights_xy = [
|
weights_xy = [
|
||||||
for(state = hashmap_keys(weights))
|
for(state = states_xy)
|
||||||
if(has(states_xy, state))
|
let(w = hashmap_get(weights, state))
|
||||||
[state, hashmap_get(weights, state)]
|
if(w != undef)
|
||||||
],
|
[state, w]
|
||||||
|
],
|
||||||
totalWeights = sum([for(w = weights_xy) w[1]]),
|
totalWeights = sum([for(w = weights_xy) w[1]]),
|
||||||
threshold = rand() * totalWeights,
|
threshold = rand() * totalWeights,
|
||||||
states_weights = weights_xy
|
states_weights = weights_xy
|
||||||
|
Reference in New Issue
Block a user