mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 06:08:31 +01:00
refactor
This commit is contained in:
parent
07170ed1f0
commit
1428dc8307
@ -1,9 +0,0 @@
|
||||
use <../turtle2d.scad>;
|
||||
|
||||
function _footprints2(cmds, t, leng, i = 0) =
|
||||
i == leng ? [] :
|
||||
let(
|
||||
nxt = turtle2d(cmds[i][0], t, cmds[i][1]),
|
||||
pts = _footprints2(cmds, nxt, leng, i + 1)
|
||||
)
|
||||
cmds[i][0] != "forward" ? pts : [turtle2d("pt", nxt), each pts];
|
@ -1,9 +0,0 @@
|
||||
use <../turtle3d.scad>;
|
||||
|
||||
function _footprints3(cmds, t, leng, i = 0) =
|
||||
i == leng ? [] :
|
||||
let(
|
||||
nxt = turtle3d(cmds[i][0], t, cmds[i][1]),
|
||||
pts = _footprints3(cmds, nxt, leng, i + 1)
|
||||
)
|
||||
cmds[i][0] != "forward" ? pts : [turtle3d("pt", nxt), each pts];
|
@ -1,3 +1,4 @@
|
||||
|
||||
/**
|
||||
* footprints2.scad
|
||||
*
|
||||
@ -8,9 +9,14 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_footprints2.scad>;
|
||||
use <turtle2d.scad>;
|
||||
|
||||
function footprints2(cmds, start = [0, 0]) =
|
||||
let(t = turtle2d("create", start.x, start.y, 0))
|
||||
[turtle2d("pt", t), each _footprints2(cmds, t, len(cmds))];
|
||||
let(leng = len(cmds))
|
||||
[start, each [
|
||||
for(i = 0, t = turtle2d(cmds[i][0], turtle2d("create", start.x, start.y, 0), cmds[i][1]);
|
||||
i < leng;
|
||||
i = i + 1,
|
||||
t = turtle2d(cmds[i][0], t, cmds[i][1]))
|
||||
if(cmds[i][0] == "forward") turtle2d("pt", t)
|
||||
]];
|
@ -8,9 +8,14 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_footprints3.scad>;
|
||||
use <turtle3d.scad>;
|
||||
|
||||
function footprints3(cmds, start = [0, 0, 0]) =
|
||||
let(t = turtle3d("create", start, [[1, 0, 0], [0, 1, 0], [0, 0, 1]]))
|
||||
[turtle3d("pt", t), each _footprints3(cmds, t, len(cmds))];
|
||||
let(leng = len(cmds))
|
||||
[start, each [
|
||||
for(i = 0, t = turtle3d(cmds[i][0], turtle3d("create", start, [[1, 0, 0], [0, 1, 0], [0, 0, 1]]), cmds[i][1]);
|
||||
i < leng;
|
||||
i = i + 1,
|
||||
t = turtle3d(cmds[i][0], t, cmds[i][1]))
|
||||
if(cmds[i][0] == "forward") turtle3d("pt", t)
|
||||
]];
|
||||
|
Loading…
x
Reference in New Issue
Block a user