Skip to content

Commit f150df6

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.HatMonotile ( Fixes #196 )
1 parent 9d8a6ee commit f150df6

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

Turtle.types.ps1xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,63 @@ return $this.Step(
788788
)
789789
</Script>
790790
</ScriptMethod>
791+
<ScriptMethod>
792+
<Name>HatMonotile</Name>
793+
<Script>
794+
&lt;#
795+
.SYNOPSIS
796+
Draws a hat aperiodic monotile.
797+
.DESCRIPTION
798+
This function uses turtle graphics to draw an aperiodic monotile called a "Hat"
799+
.EXAMPLE
800+
turtle rotate -90 hatMonotile 100 save ./hatMonotile.svg
801+
.LINK
802+
https://github.com/christianp/aperiodic-monotile/blob/main/hat-monotile.logo
803+
#&gt;
804+
param(
805+
[double]
806+
$A = 100,
807+
808+
[double]
809+
$B = 0
810+
)
811+
812+
if (-not $B) {
813+
$B = [Math]::Tan(60 * [Math]::PI / 180) * $A
814+
}
815+
816+
817+
return $this.
818+
Forward($b).
819+
Rotate(90).
820+
Forward($a).
821+
Left(60).
822+
Forward($a).
823+
Rotate(90).
824+
Forward($b).
825+
Rotate(60).
826+
Forward($b).
827+
Left(90).
828+
Forward($a).
829+
Rotate(60).
830+
Forward($a).
831+
Rotate(90).
832+
Forward($b).
833+
Rotate(60).
834+
Forward($b).
835+
Left(90).
836+
Forward($a).
837+
Rotate(60).
838+
Forward($a).
839+
Forward($a).
840+
Rotate(60).
841+
Forward($a).
842+
Rotate(90).
843+
Forward($b).
844+
Left(60)
845+
846+
</Script>
847+
</ScriptMethod>
791848
<ScriptMethod>
792849
<Name>HilbertCurve</Name>
793850
<Script>

0 commit comments

Comments
 (0)