File: TurtleGraphics.ijm

package info (click to toggle)
imagej 1.54g-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,520 kB
  • sloc: java: 132,209; sh: 286; xml: 255; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// include https://imagej.net/ij/macros/TurtleGraphicsLibrary.ijm
// Author: Jerome Mutterer
//
// The 'include' in the first line is ignored by the Fiji
// script editor. To work around this problem, append the
// contents of TurtleGraphicsLibrary.ijm to the end of
// this macro.

requires("1.54d");
turtleGraphics();
clearScreen();
//hideTurtle();

setColor("red");
for (i=0;i<60;i++) {
    forward(30);
    right(15*(i%5));
}

setColor("blue");
setLineWidth(2);
for (i=0;i<72;i++) {
    penDown();
    if (i%2==0) penUp();
    forward(10); 
    left(5);
}

penUp();
setPosXY(100,-100);
penDown();
setColor("magenta");
square (100);

function square(side) {
    for (i=0;i<4;i++) {
        forward(side);
        right(90);
    }
}