mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-03 21:37:39 +02:00
refactor: use m_replace
This commit is contained in:
@@ -8,6 +8,7 @@ use <util/map/hashmap_keys.scad>;
|
|||||||
use <util/map/hashmap_entries.scad>;
|
use <util/map/hashmap_entries.scad>;
|
||||||
use <util/set/hashset.scad>;
|
use <util/set/hashset.scad>;
|
||||||
use <util/set/hashset_elems.scad>;
|
use <util/set/hashset_elems.scad>;
|
||||||
|
use <matrix/m_replace.scad>;
|
||||||
|
|
||||||
function weights_of_tiles(sample) =
|
function weights_of_tiles(sample) =
|
||||||
let(
|
let(
|
||||||
@@ -81,26 +82,11 @@ function wf_entropy_weights(wf, x, y) =
|
|||||||
[ln(sumOfWeights) - (sumOfWeightLogWeights / sumOfWeights) - rand() / 1000, weights];
|
[ln(sumOfWeights) - (sumOfWeightLogWeights / sumOfWeights) - rand() / 1000, weights];
|
||||||
|
|
||||||
function _replaceStatesAt(wf, x, y, states) =
|
function _replaceStatesAt(wf, x, y, states) =
|
||||||
let(
|
|
||||||
eigenstates = wf_eigenstates(wf),
|
|
||||||
rowY = eigenstates[y],
|
|
||||||
leng_rowY = len(rowY),
|
|
||||||
leng_eigenstates = len(eigenstates),
|
|
||||||
newRowY = [
|
|
||||||
each [for(i = 0; i < x; i = i + 1) rowY[i]],
|
|
||||||
states,
|
|
||||||
each [for(i = x + 1; i < leng_rowY; i = i + 1) rowY[i]]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
[
|
[
|
||||||
wf_width(wf),
|
wf_width(wf),
|
||||||
wf_height(wf),
|
wf_height(wf),
|
||||||
wf_weights(wf),
|
wf_weights(wf),
|
||||||
[
|
m_replace(wf_eigenstates(wf), x, y, states)
|
||||||
each [for(i = 0; i < y; i = i + 1) eigenstates[i]],
|
|
||||||
newRowY,
|
|
||||||
each [for(i = y + 1; i < leng_eigenstates; i = i + 1) eigenstates[i]]
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
function wf_not_collapsed_coords(wf, notCollaspedCoords) =
|
function wf_not_collapsed_coords(wf, notCollaspedCoords) =
|
||||||
|
Reference in New Issue
Block a user