Skip to content

Commit cf8ff4b

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.LevyCurve() ( Fixes #155 )
1 parent 1b82ad8 commit cf8ff4b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Turtle.types.ps1xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,37 @@ param(
835835
$this.Rotate($Angle * -1)
836836
</Script>
837837
</ScriptMethod>
838+
<ScriptMethod>
839+
<Name>LevyCurve</Name>
840+
<Script>
841+
&lt;#
842+
.SYNOPSIS
843+
Draws a Levy Curve
844+
.DESCRIPTION
845+
Draws a Levy Curve L-System
846+
.LINK
847+
https://paulbourke.net/fractals/lsys/
848+
#&gt;
849+
param(
850+
# The size of each segment.
851+
[double]$Size = 10,
852+
# The number of expansions (the order of magnitude)
853+
[int]$Order = 4,
854+
# The angle
855+
[double]$Angle = 45
856+
)
857+
858+
$this.LSystem('F', @{
859+
F='-F++F-'
860+
}, $Order, [Ordered]@{
861+
'\+' = { $this.Rotate($angle)}
862+
'-' = { $this.Rotate($angle * -1)}
863+
'F' = { $this.Forward($size)}
864+
})
865+
866+
867+
</Script>
868+
</ScriptMethod>
838869
<ScriptMethod>
839870
<Name>LSystem</Name>
840871
<Script>

0 commit comments

Comments
 (0)