File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,48 @@ return $this.LSystem('F', @{
167167})
168168 </Script >
169169 </ScriptMethod >
170+ <ScriptMethod >
171+ <Name >KochIsland</Name >
172+ <Script >
173+ < #
174+ .SYNOPSIS
175+ Generates a Koch Island
176+ .DESCRIPTION
177+ Generates a Koch Island using turtle graphics.
178+ .EXAMPLE
179+ $turtle.KochIsland().Pattern.Save("$pwd/KochIsland.svg")
180+ .EXAMPLE
181+ $turtle.Clear()
182+ $turtle.KochIsland(10,4)
183+ $turtle.PatternTransform = @{
184+ 'scale' = 0.9
185+ }
186+ $turtle.PatternAnimation = "
187+ < animateTransform attributeName='patternTransform' attributeType='XML' type='scale' values='1;0.9;1' dur='19s' repeatCount='indefinite' additive='sum' />
188+ < animateTransform attributeName='patternTransform' attributeType='XML' type='skewY' values='0;-30;30;-30;0' dur='67s' repeatCount='indefinite' additive='sum' />
189+ < animateTransform attributeName='patternTransform' attributeType='XML' type='skewX' values='0;-30;30;-30;0' dur='83s' repeatCount='indefinite' additive='sum' />
190+ < animateTransform attributeName='patternTransform' attributeType='XML' type='rotate' values='0;360' dur='163s' repeatCount='indefinite' additive='sum' />
191+ < animateTransform attributeName='patternTransform' attributeType='XML' type='translate' values='0 0;200 200;0 0' dur='283s' repeatCount='indefinite' additive='sum' />
192+ "
193+ $turtle.Pattern.Save("$pwd/KochIsland2.svg")
194+ #>
195+ param(
196+ [double]$Size = 20,
197+ [int]$Order = 3,
198+ [double]$Angle = 90
199+ )
200+
201+ return $this.LSystem('W', [Ordered]@{
202+ W = 'F+F+F+F'
203+ F = 'F+F-F-FF+F+F-F'
204+ }, $Order, [Ordered]@{
205+ '\+' = { $this.Rotate($Angle) }
206+ '-' = { $this.Rotate($Angle * -1) }
207+ '[FG]' = { $this.Forward($Size) }
208+ })
209+
210+ </Script >
211+ </ScriptMethod >
170212 <ScriptMethod >
171213 <Name >KochSnowflake</Name >
172214 <Script >
You can’t perform that action at this time.
0 commit comments