mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 09:44:16 +02:00
rename
This commit is contained in:
@@ -164,23 +164,23 @@ function wf_not_collapsed_coords(wf) = [
|
|||||||
[x, y]
|
[x, y]
|
||||||
];
|
];
|
||||||
|
|
||||||
function coord_min_entropy(wf) =
|
function wf_coord_min_entropy(wf) =
|
||||||
let(
|
let(
|
||||||
coords = wf_not_collapsed_coords(wf),
|
coords = wf_not_collapsed_coords(wf),
|
||||||
coords_leng = len(coords),
|
coords_leng = len(coords),
|
||||||
entropyCoord = coords[0],
|
entropyCoord = coords[0],
|
||||||
entropy = wf_entropy(wf, entropyCoord[0], entropyCoord[1]) - (rand() / 1000)
|
entropy = wf_entropy(wf, entropyCoord[0], entropyCoord[1]) - (rand() / 1000)
|
||||||
)
|
)
|
||||||
_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord);
|
_wf_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord);
|
||||||
|
|
||||||
function _coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord, i = 1) =
|
function _wf_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord, i = 1) =
|
||||||
i == coords_leng ? entropyCoord :
|
i == coords_leng ? entropyCoord :
|
||||||
let(
|
let(
|
||||||
coord = coords[i],
|
coord = coords[i],
|
||||||
noisedEntropy = wf_entropy(wf, coord[0], coord[1]) - (rand() / 1000)
|
noisedEntropy = wf_entropy(wf, coord[0], coord[1]) - (rand() / 1000)
|
||||||
)
|
)
|
||||||
noisedEntropy < entropy ? _coord_min_entropy(wf, coords, coords_leng, noisedEntropy, coord, i + 1) :
|
noisedEntropy < entropy ? _wf_coord_min_entropy(wf, coords, coords_leng, noisedEntropy, coord, i + 1) :
|
||||||
_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord, i + 1);
|
_wf_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord, i + 1);
|
||||||
|
|
||||||
|
|
||||||
width = len(sample[0]);
|
width = len(sample[0]);
|
||||||
@@ -200,4 +200,4 @@ for(y = [0:height - 1]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(wf_entropy(wf, 0, 0) == 1.458879520793018);
|
assert(wf_entropy(wf, 0, 0) == 1.458879520793018);
|
||||||
assert(coord_min_entropy(wf_collapse(wf, 0, 0)) != [0, 0]);
|
assert(wf_coord_min_entropy(wf_collapse(wf, 0, 0)) != [0, 0]);
|
||||||
|
Reference in New Issue
Block a user