File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1433,6 +1433,43 @@ return $this.Rotate(-90).LSystem('-X', [Ordered]@{
14331433 '\-' = { $this.Rotate($angle * -1)}
14341434 '\[' = { $this.Push() }
14351435 '\]' = { $this.Pop() }
1436+ })
1437+ </Script >
1438+ </ScriptMethod >
1439+ <ScriptMethod >
1440+ <Name >FractalShrub</Name >
1441+ <Script >
1442+ < #
1443+ .SYNOPSIS
1444+ Draws a Fractal Shrub
1445+ .DESCRIPTION
1446+ Draws a Fractal Shrub using an an L-System.
1447+
1448+ This is a modification of the fractal plant will less rotation
1449+ .LINK
1450+ https://en.wikipedia.org/wiki/L-system#Example_7:_fractal_plant
1451+ .EXAMPLE
1452+ turtle FractalShrub save ./FractalShrub.svg
1453+ .EXAMPLE
1454+ turtle FractalShrub morph save ./FractalShrubMorph.svg
1455+ #>
1456+ param(
1457+ # The size of each segment
1458+ [double]$Size = 42,
1459+ # The order of magnitude (the number of times the L-system is expanded)
1460+ [int]$Order = 4,
1461+ # The angle of each segment
1462+ [double]$Angle = -25
1463+ )
1464+ return $this.Rotate(-90).LSystem('-X', [Ordered]@{
1465+ 'X' = 'F[[X]X]F[FX]X'
1466+ 'F' = 'FF'
1467+ }, $Order, [Ordered]@{
1468+ 'F' = { $this.Forward($Size) }
1469+ #'\+' = { $this.Rotate($angle)}
1470+ # '\-' = { $this.Rotate($angle * -1)}
1471+ '\[' = { $this.Push().Rotate($angle) }
1472+ '\]' = { $this.Pop().Rotate($angle * -1) }
14361473})
14371474 </Script >
14381475 </ScriptMethod >
You can’t perform that action at this time.
0 commit comments