Skip to content

Commit 8789238

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.StepCurve ( Fixes #329 )
1 parent 81475d5 commit 8789238

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Turtle.types.ps1xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4716,6 +4716,39 @@ if ($DeltaX -or $DeltaY) {
47164716
}
47174717
}
47184718

4719+
return $this
4720+
4721+
</Script>
4722+
</ScriptMethod>
4723+
<ScriptMethod>
4724+
<Name>StepCurve</Name>
4725+
<Script>
4726+
&lt;#
4727+
.SYNOPSIS
4728+
Takes a curved step
4729+
.DESCRIPTION
4730+
Makes a relative movement with a curve.
4731+
.EXAMPLE
4732+
turtle viewbox 20 teleport 10 0 stepCurve 5 5 stepCurve -5 0 stepCurve 0 -5 closepath
4733+
#&gt;
4734+
param(
4735+
# The DeltaX
4736+
[double]$DeltaX = $(Get-Random -Min 0 -Max 100.0),
4737+
# The DeltaY
4738+
[double]$DeltaY = $(Get-Random -Min 0 -Max 100.0)
4739+
)
4740+
4741+
# If both coordinates are empty, there is no step
4742+
if ($DeltaX -or $DeltaY) {
4743+
4744+
$this.Position = $DeltaX, $DeltaY
4745+
if ($This.IsPenDown) {
4746+
$this.Steps.Add(" t $deltaX $deltaY")
4747+
} else {
4748+
$this.Steps.Add(" m $DeltaX $DeltaY")
4749+
}
4750+
}
4751+
47194752
return $this
47204753

47214754
</Script>

0 commit comments

Comments
 (0)