Skip to content

Commit 0487a54

Browse files
author
James Brundage
committed
fix: Explicitly clearing position ( Fixes #30 )
This impacts ViewBox caculations on repeated executions, since the effective start position of the cursor is maintained.
2 parents 3d6c430 + a49eb70 commit 0487a54

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Turtle.types.ps1xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,50 @@ $null = foreach ($n in 1..4) {
192192
return $this
193193
</Script>
194194
</ScriptMethod>
195+
<ScriptMethod>
196+
<Name>TwinDragonCurve</Name>
197+
<Script>
198+
&lt;#
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+
&lt;animateTransform attributeName='patternTransform' attributeType='XML' type='scale' values='1;0.9;1' dur='19s' repeatCount='indefinite' additive='sum' /&gt;
217+
&lt;animateTransform attributeName='patternTransform' attributeType='XML' type='skewY' values='30;-30;30' dur='67s' repeatCount='indefinite' additive='sum' /&gt;
218+
&lt;animateTransform attributeName='patternTransform' attributeType='XML' type='skewX' values='30;-30;30' dur='83s' repeatCount='indefinite' additive='sum' /&gt;
219+
"
220+
$turtle.Pattern.Save("$pwd/TwinDragonCurve2.svg")
221+
#&gt;
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>

0 commit comments

Comments
 (0)