Skip to content

Commit 8f67c2c

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.FractalPlant() ( Fixes #95 )
1 parent 2d1cf97 commit 8f67c2c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Turtle.types.ps1xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,26 @@ if ($This.IsPenDown) {
305305
return $this
306306
</Script>
307307
</ScriptMethod>
308+
<ScriptMethod>
309+
<Name>FractalPlant</Name>
310+
<Script>
311+
param(
312+
[double]$Size = 20,
313+
[int]$Order = 4,
314+
[double]$Angle = 25
315+
)
316+
return $this.Rotate(-90).LSystem('-X', [Ordered]@{
317+
'X' = 'F+[[X]-X]-F[-FX]+X'
318+
'F' = 'FF'
319+
}, $Order, [Ordered]@{
320+
'F' = { $this.Forward($Size) }
321+
'\[' = { $this.Rotate($Angle * -1).Push() }
322+
'\]' = { $this.Pop().Rotate($Angle) }
323+
})
324+
325+
326+
</Script>
327+
</ScriptMethod>
308328
<ScriptMethod>
309329
<Name>GosperCurve</Name>
310330
<Script>

0 commit comments

Comments
 (0)