1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00

add m_replace

This commit is contained in:
Justin Lin 2022-04-17 10:44:38 +08:00
parent d3e1cfea97
commit 6f880aa794
2 changed files with 18 additions and 0 deletions

View File

@ -23,6 +23,8 @@ new:
- sorted, contains
- m_replace?
deprecated:
rails2sections: use m_transpose
has

16
src/matrix/m_replace.scad Normal file
View File

@ -0,0 +1,16 @@
function m_replace(m, x, y, value) =
let(
rowY = m[y],
leng_rowY = len(rowY),
newRowY = [
each [for(i = 0; i < x; i = i + 1) rowY[i]],
value,
each [for(i = x + 1; i < leng_rowY; i = i + 1) rowY[i]]
],
row_leng = len(m)
)
[
each [for(i = 0; i < y; i = i + 1) m[i]],
newRowY,
each [for(i = y + 1; i < row_leng; i = i + 1) m[i]]
];