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:
parent
d3e1cfea97
commit
6f880aa794
@ -23,6 +23,8 @@ new:
|
||||
|
||||
- sorted, contains
|
||||
|
||||
- m_replace?
|
||||
|
||||
deprecated:
|
||||
rails2sections: use m_transpose
|
||||
has
|
||||
|
16
src/matrix/m_replace.scad
Normal file
16
src/matrix/m_replace.scad
Normal 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]]
|
||||
];
|
Loading…
x
Reference in New Issue
Block a user