mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-18 12:31:17 +02:00
refactor: use m_replace
This commit is contained in:
@@ -1,23 +1,15 @@
|
|||||||
use <_mz_cube_comm.scad>;
|
use <_mz_cube_comm.scad>;
|
||||||
use <../../util/shuffle.scad>;
|
use <../../util/shuffle.scad>;
|
||||||
|
use <../../matrix/m_replace.scad>;
|
||||||
|
|
||||||
function update(cells, cell) =
|
function update(cells, cell) =
|
||||||
let(
|
let(
|
||||||
x = cell.x,
|
x = cell.x,
|
||||||
y = cell.y,
|
y = cell.y,
|
||||||
z = cell.z,
|
z = cell.z,
|
||||||
rowY = [for(c = cells[z][y]) if(c.x == x) cell else c],
|
rowY = [for(c = cells[z][y]) if(c.x == x) cell else c]
|
||||||
layerZ = [
|
|
||||||
for(r = [0:len(cells[z]) - 1])
|
|
||||||
if(r == y) rowY
|
|
||||||
else cells[z][r]
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
[
|
m_replace(cells, y, z, rowY);
|
||||||
for(layer = [0:len(cells) - 1])
|
|
||||||
if(layer == z) layerZ
|
|
||||||
else cells[layer]
|
|
||||||
];
|
|
||||||
|
|
||||||
// is (x, y) visited?
|
// is (x, y) visited?
|
||||||
function visited(x, y, z, cells) = cells[z][y][x][4];
|
function visited(x, y, z, cells) = cells[z][y][x][4];
|
||||||
|
Reference in New Issue
Block a user