File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ Generates a Koch Island
4+ . DESCRIPTION
5+ Generates a Koch Island using turtle graphics.
6+ . EXAMPLE
7+ $turtle.KochIsland().Pattern.Save("$pwd/KochIsland.svg")
8+ . EXAMPLE
9+ $turtle.Clear()
10+ $turtle.KochIsland(10,4)
11+ $turtle.PatternTransform = @{
12+ 'scale' = 0.9
13+ }
14+ $turtle.PatternAnimation = "
15+ <animateTransform attributeName='patternTransform' attributeType='XML' type='scale' values='1;0.9;1' dur='19s' repeatCount='indefinite' additive='sum' />
16+ <animateTransform attributeName='patternTransform' attributeType='XML' type='skewY' values='0;-30;30;-30;0' dur='67s' repeatCount='indefinite' additive='sum' />
17+ <animateTransform attributeName='patternTransform' attributeType='XML' type='skewX' values='0;-30;30;-30;0' dur='83s' repeatCount='indefinite' additive='sum' />
18+ <animateTransform attributeName='patternTransform' attributeType='XML' type='rotate' values='0;360' dur='163s' repeatCount='indefinite' additive='sum' />
19+ <animateTransform attributeName='patternTransform' attributeType='XML' type='translate' values='0 0;200 200;0 0' dur='283s' repeatCount='indefinite' additive='sum' />
20+ "
21+ $turtle.Pattern.Save("$pwd/KochIsland2.svg")
22+ #>
23+ param (
24+ [double ]$Size = 20 ,
25+ [int ]$Order = 3 ,
26+ [double ]$Angle = 90
27+ )
28+
29+ return $this.LSystem (' W' , [Ordered ]@ {
30+ W = ' F+F+F+F'
31+ F = ' F+F-F-FF+F+F-F'
32+ }, $Order , [Ordered ]@ {
33+ ' \+' = { $this.Rotate ($Angle ) }
34+ ' -' = { $this.Rotate ($Angle * -1 ) }
35+ ' [FG]' = { $this.Forward ($Size ) }
36+ })
You can’t perform that action at this time.
0 commit comments