Skip to content

Commit a6bba72

Browse files
author
James Brundage
committed
feat: Turtle.TurtleMonotile ( Fixes #195 )
1 parent d5c6798 commit a6bba72

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Types/Turtle/TurtleMonotile.ps1

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<#
2+
.SYNOPSIS
3+
Draws a turtle aperiodic monotile.
4+
.DESCRIPTION
5+
This function uses turtle graphics to draw an aperiodic monotile called a "Turtle"
6+
.EXAMPLE
7+
turtle rotate -90 turtleMonotile 100 save ./turtleMonotile.svg
8+
.LINK
9+
https://github.com/christianp/aperiodic-monotile/blob/main/turtle-monotile.logo
10+
#>
11+
param(
12+
[double]
13+
$A = 100,
14+
15+
[double]
16+
$B = 0
17+
)
18+
19+
if (-not $B) {
20+
$B = [Math]::Tan(60 * [Math]::PI / 180) * $A
21+
}
22+
23+
return $this.
24+
Rotate(90).
25+
Forward($a).
26+
Rotate(60).
27+
Forward($a).
28+
Rotate(-90).
29+
Forward($b).
30+
Rotate(60).
31+
Forward($b).
32+
Forward($b).
33+
Rotate(60).
34+
Forward($b).
35+
Rotate(90).
36+
Forward($a).
37+
Rotate(-60).
38+
Forward($a).
39+
Rotate(90).
40+
Forward($b).
41+
Rotate(-60).
42+
Forward($b).
43+
Rotate(90).
44+
Forward($a).
45+
Rotate(60).
46+
Forward($a).
47+
Rotate(-90).
48+
Forward($b).
49+
Rotate(60).
50+
Forward($b)
51+
52+
return
53+
54+

0 commit comments

Comments
 (0)