We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Turtle.MooreCurve()
1 parent 7c85711 commit b601fb9Copy full SHA for b601fb9
Types/Turtle/MooreCurve.ps1
@@ -0,0 +1,35 @@
1
+<#
2
+.SYNOPSIS
3
+ Generates a Moore curve.
4
+.DESCRIPTION
5
+ Generates a Moore curve using turtle graphics.
6
+.LINK
7
+ https://en.wikipedia.org/wiki/Moore_curve
8
+.EXAMPLE
9
+ $turtle = New-Turtle
10
+ $turtle.MooreCurve().Pattern.Save("$pwd/MooreCurvePattern.svg")
11
12
+ Move-Turtle MooreCurve 15 5 |
13
+ Set-Turtle Stroke '#4488ff' |
14
+ Save-Turtle "./MooreCurve.svg"
15
+#>
16
+param(
17
+ [double]$Size = 10,
18
+ [int]$Order = 5,
19
+ [double]$Angle = 90
20
+)
21
+
22
23
+return $this.LSystem(
24
+ 'LFL+F+LFL',
25
+ [Ordered]@{
26
+ L = '-RF+LFL+FR-'
27
+ R = '+LF-RFR-FL+'
28
+ },
29
+ 4,
30
+ @{
31
+ F = { $this.Forward(10) }
32
+ '\+' = { $this.Rotate(90) }
33
+ '-' = { $this.Rotate(-90) }
34
+ }
35
0 commit comments