File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ Draws a Fractal Shrub
4+ . DESCRIPTION
5+ Draws a Fractal Shrub using an an L-System.
6+
7+ This is a modification of the fractal plant will less rotation
8+ . LINK
9+ https://en.wikipedia.org/wiki/L-system#Example_7:_fractal_plant
10+ . EXAMPLE
11+ turtle FractalShrub save ./FractalShrub.svg
12+ . EXAMPLE
13+ turtle FractalShrub morph save ./FractalShrubMorph.svg
14+ #>
15+ param (
16+ # The size of each segment
17+ [double ]$Size = 42 ,
18+ # The order of magnitude (the number of times the L-system is expanded)
19+ [int ]$Order = 4 ,
20+ # The angle of each segment
21+ [double ]$Angle = -25
22+ )
23+ return $this.Rotate (-90 ).LSystem(' -X' , [Ordered ]@ {
24+ ' X' = ' F[[X]X]F[FX]X'
25+ ' F' = ' FF'
26+ }, $Order , [Ordered ]@ {
27+ ' F' = { $this.Forward ($Size ) }
28+ # '\+' = { $this.Rotate($angle)}
29+ # '\-' = { $this.Rotate($angle * -1)}
30+ ' \[' = { $this.Push ().Rotate($angle ) }
31+ ' \]' = { $this.Pop ().Rotate($angle * -1 ) }
32+ })
You can’t perform that action at this time.
0 commit comments