Skip to content

Commit 9d8a6ee

Browse files
author
James Brundage
committed
feat: Turtle.HatMonotile ( Fixes #196 )
1 parent 047c394 commit 9d8a6ee

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

Types/Turtle/HatMonotile.ps1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<#
2+
.SYNOPSIS
3+
Draws a hat aperiodic monotile.
4+
.DESCRIPTION
5+
This function uses turtle graphics to draw an aperiodic monotile called a "Hat"
6+
.EXAMPLE
7+
turtle rotate -90 hatMonotile 100 save ./hatMonotile.svg
8+
.LINK
9+
https://github.com/christianp/aperiodic-monotile/blob/main/hat-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+
24+
return $this.
25+
Forward($b).
26+
Rotate(90).
27+
Forward($a).
28+
Left(60).
29+
Forward($a).
30+
Rotate(90).
31+
Forward($b).
32+
Rotate(60).
33+
Forward($b).
34+
Left(90).
35+
Forward($a).
36+
Rotate(60).
37+
Forward($a).
38+
Rotate(90).
39+
Forward($b).
40+
Rotate(60).
41+
Forward($b).
42+
Left(90).
43+
Forward($a).
44+
Rotate(60).
45+
Forward($a).
46+
Forward($a).
47+
Rotate(60).
48+
Forward($a).
49+
Rotate(90).
50+
Forward($b).
51+
Left(60)

0 commit comments

Comments
 (0)