File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,50 @@ $null = foreach ($n in 1..4) {
192192return $this
193193 </Script >
194194 </ScriptMethod >
195+ <ScriptMethod >
196+ <Name >TwinDragonCurve</Name >
197+ <Script >
198+ < #
199+ .SYNOPSIS
200+ Generates a Twin Dragon Curve.
201+ .DESCRIPTION
202+ Generates a Twin Dragon Curve using turtle graphics.
203+ .LINK
204+ https://en.wikipedia.org/wiki/Dragon_curve#Twindragon
205+ .EXAMPLE
206+ $turtle.TwinDragonCurve().Pattern.Save("$pwd/TwinDragonCurve.svg")
207+ .EXAMPLE
208+ $turtle.Clear()
209+ $turtle.TwinDragonCurve(20,7,90)
210+ $turtle.PatternTransform = @{
211+ 'scale' = 0.9
212+ 'rotate' = 45
213+ }
214+
215+ $turtle.PatternAnimation = "
216+ < animateTransform attributeName='patternTransform' attributeType='XML' type='scale' values='1;0.9;1' dur='19s' repeatCount='indefinite' additive='sum' />
217+ < animateTransform attributeName='patternTransform' attributeType='XML' type='skewY' values='30;-30;30' dur='67s' repeatCount='indefinite' additive='sum' />
218+ < animateTransform attributeName='patternTransform' attributeType='XML' type='skewX' values='30;-30;30' dur='83s' repeatCount='indefinite' additive='sum' />
219+ "
220+ $turtle.Pattern.Save("$pwd/TwinDragonCurve2.svg")
221+ #>
222+
223+ param(
224+ [double]$Size = 20,
225+ [int]$Order = 6,
226+ [double]$Angle = 90
227+ )
228+ return $this.L('FX+FX+', [Ordered]@{
229+ X = 'X+YF'
230+ Y = 'FX-Y'
231+ }, $Order, [Ordered]@{
232+ '\+' = { $this.Rotate($Angle) }
233+ '-' = { $this.Rotate($Angle * -1) }
234+ '[F]' = { $this.Forward($Size) }
235+ })
236+
237+ </Script >
238+ </ScriptMethod >
195239 <ScriptProperty >
196240 <Name >Heading</Name >
197241 <GetScriptBlock >
You can’t perform that action at this time.
0 commit comments