1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 20:08:21 +01:00

support pitch and roll

This commit is contained in:
Justin Lin 2020-04-15 08:51:25 +08:00
parent 5a5ee8e97f
commit c48712d91b
2 changed files with 12 additions and 3 deletions

View File

@ -19,9 +19,13 @@ function _next_t1(t1, t2, code, stack) =
function _next_t2(t, code, angle, leng) =
is_undef(code) || code == "[" || code == "]" ? t :
code == "F" || code == "f" ? turtle3d("xu_move", t, leng) :
code == "+" ? turtle3d("zu_turn", t, angle) :
code == "-" ? turtle3d("zu_turn", t, -angle) :
code == "|" ? turtle2d("zu_turn", t, 180) : t;
code == "+" ? turtle3d("zu_turn", t, angle) :
code == "-" ? turtle3d("zu_turn", t, -angle) :
code == "|" ? turtle3d("zu_turn", t, 180) :
code == "&" ? turtle3d("yu_turn", t, angle) :
code == "∧" ? turtle3d("yu_turn", t, -angle) :
code == "\\" ? turtle3d("xu_turn", t, angle) :
code == "/" ? turtle3d("xu_turn", t, -angle) : t;
// It doesn't use recursion to avoid recursion error.
function _lines(t, codes, angle, leng) =

View File

@ -7,6 +7,11 @@ use <turtle/turtle3d.scad>;
f Move forward without drawing a line
+ Turn left
- Turn right
| Reverse direction (ie: turn by 180 degrees)
& Pitch down
Pitch up
\ Roll left
/ Roll right
[ Push current turtle state onto stack
] Pop current turtle state from the stack