mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-09 00:06:42 +02:00
add m_replace
This commit is contained in:
@@ -23,6 +23,8 @@ new:
|
|||||||
|
|
||||||
- sorted, contains
|
- sorted, contains
|
||||||
|
|
||||||
|
- m_replace?
|
||||||
|
|
||||||
deprecated:
|
deprecated:
|
||||||
rails2sections: use m_transpose
|
rails2sections: use m_transpose
|
||||||
has
|
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]]
|
||||||
|
];
|
Reference in New Issue
Block a user