File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 16
16
MoveTo = ' Teleport'
17
17
Back = ' Backward'
18
18
bk = ' Backward'
19
+ ArcR = ' ArcRight'
20
+ ArcL = ' ArcLeft'
19
21
}
Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Arcs the turtle to the left
4
+ . DESCRIPTION
5
+ Arcs the turtle to the left (counter-clockwise) a number of degrees.
6
+
7
+ For each degree, the turtle will move forward and rotate.
8
+ . NOTES
9
+ The amount moved forward will be the portion of the circumference.
10
+ #>
11
+ param (
12
+ # The radius of a the circle, were it to complete the arc.
13
+ [double ]
14
+ $Radius = 10 ,
15
+
16
+ # The angle of the arc
17
+ [double ]
18
+ $Angle = 60
19
+ )
20
+
21
+ # Rather than duplicate logic, we will simply reverse the angle
22
+ $angle *= -1
23
+ # and arc to the "right".
24
+ return $this.ArcRight ($Radius , $Angle )
Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Arcs the turtle to the right
4
+ . DESCRIPTION
5
+ Arcs the turtle to the right (clockwise) a number of degrees.
6
+
7
+ For each degree, the turtle will move forward and rotate.
8
+ . NOTES
9
+ The amount moved forward will be the portion of the circumference.
10
+ #>
11
+ param (
12
+ # The radius of a the circle, were it to complete the arc.
13
+ [double ]
14
+ $Radius = 10 ,
15
+
16
+ # The angle of the arc
17
+ [double ]
18
+ $Angle = 60
19
+ )
20
+
21
+
22
+ # Determine the absolute angle, for this
23
+ $absAngle = [Math ]::Abs($angle )
24
+ $circumferenceStep = ([Math ]::PI * 2 * $Radius ) / $absAngle
25
+
26
+ $iteration = $angle / [Math ]::Floor($absAngle )
27
+ $angleDelta = 0
28
+ $null = while ([Math ]::Abs($angleDelta ) -lt $absAngle ) {
29
+ $this.Forward ($circumferenceStep )
30
+ $this.Rotate ($iteration )
31
+ $angleDelta += $iteration
32
+ }
33
+
34
+ return $this
You can’t perform that action at this time.
0 commit comments