Skip to content

Commit 6bfc188

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.MooreCurve() ( Fixes #81 )
1 parent b601fb9 commit 6bfc188

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Turtle.types.ps1xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,47 @@ return $this
686686

687687
</Script>
688688
</ScriptMethod>
689+
<ScriptMethod>
690+
<Name>MooreCurve</Name>
691+
<Script>
692+
&lt;#
693+
.SYNOPSIS
694+
Generates a Moore curve.
695+
.DESCRIPTION
696+
Generates a Moore curve using turtle graphics.
697+
.LINK
698+
https://en.wikipedia.org/wiki/Moore_curve
699+
.EXAMPLE
700+
$turtle = New-Turtle
701+
$turtle.MooreCurve().Pattern.Save("$pwd/MooreCurvePattern.svg")
702+
.EXAMPLE
703+
Move-Turtle MooreCurve 15 5 |
704+
Set-Turtle Stroke '#4488ff' |
705+
Save-Turtle "./MooreCurve.svg"
706+
#&gt;
707+
param(
708+
[double]$Size = 10,
709+
[int]$Order = 5,
710+
[double]$Angle = 90
711+
)
712+
713+
714+
return $this.LSystem(
715+
'LFL+F+LFL',
716+
[Ordered]@{
717+
L = '-RF+LFL+FR-'
718+
R = '+LF-RFR-FL+'
719+
},
720+
4,
721+
@{
722+
F = { $this.Forward(10) }
723+
'\+' = { $this.Rotate(90) }
724+
'-' = { $this.Rotate(-90) }
725+
}
726+
)
727+
728+
</Script>
729+
</ScriptMethod>
689730
<ScriptMethod>
690731
<Name>PeanoCurve</Name>
691732
<Script>

0 commit comments

Comments
 (0)