Introducing Turtle Graphics for MoI

 From: scott (SSHWARTS) 25 Jul 2015  (1 of 5)
 Hi All. On a whim I've written a turtle graphics script (working on top of the work of others). This script installs as a shortcut and when invoked, pops up a window where you can type (or paste) javascript. Here's some examples. This script: var sierpinski = function(n,length){ if(n == 0) return; for(var i = 0; i < 3; ++i){ sierpinski(n-1,length/2); move(length); turn(-120); } } sierpinski(7,200); Yields: Or this script: var snowFlake = function(length, iterations){ turn(120); koch(length, iterations); turn(-120); koch(length, iterations); turn(-120); koch(length, iterations); } var koch = function(length,iterations){ if(iterations==1) move(length); else{ koch(length, iterations-1); turn(60); koch(length, iterations-1); turn(-120); koch(length, iterations-1); turn(60); koch(length, iterations-1); } }; snowFlake(3,5); Gets you: This script: for (var i = 0; i < 300; i++) { move (i); turn (100); } Gets you: The commands are: move(d); -- moves d units drawing a line jump(d); -- jump d units without drawing turn(a); -- turn 'a' degrees (CW) pitch(a); -- pitch 'a' degrees downwards (CCW) circle(d); -- draws a circle of d diameter at current position. Not turtle per se, but useful. print(var); -- prints to the console useful for debugging Currently, I do not join the line segments so you can end up with a lot of them. Let me know if it would be better to join them. You can find some useful scripts to modify and use here: http://spencertipping.com/beta/cheloniidae-live-b1/ I based the commands on the ones used there and the examples come from there as well (note that there's no 'bank' command). Enjoy and give some feedback or help me improve the script please. There's probably lots of bugs or better ways to do something. I wrote it to help me design some patterned panels to be lasercut. Scott EDITED: 26 Jul 2015 by SSHWARTS

 From: Michael Gibson 25 Jul 2015  (2 of 5)
 7515.2 In reply to 7515.1 Cool stuff Scott, thanks for sharing it! - Michael