|
15 | 15 | </PropertySet>
|
16 | 16 | </Members>
|
17 | 17 | </MemberSet>
|
| 18 | + <AliasProperty> |
| 19 | + <Name>ArcL</Name> |
| 20 | + <ReferencedMemberName>ArcLeft</ReferencedMemberName> |
| 21 | + </AliasProperty> |
| 22 | + <AliasProperty> |
| 23 | + <Name>ArcR</Name> |
| 24 | + <ReferencedMemberName>ArcRight</ReferencedMemberName> |
| 25 | + </AliasProperty> |
18 | 26 | <AliasProperty>
|
19 | 27 | <Name>Back</Name>
|
20 | 28 | <ReferencedMemberName>Backward</ReferencedMemberName>
|
|
83 | 91 | <Name>yPos</Name>
|
84 | 92 | <ReferencedMemberName>ycor</ReferencedMemberName>
|
85 | 93 | </AliasProperty>
|
| 94 | + <ScriptMethod> |
| 95 | + <Name>ArcLeft</Name> |
| 96 | + <Script> |
| 97 | + <# |
| 98 | +.SYNOPSIS |
| 99 | + Arcs the turtle to the left |
| 100 | +.DESCRIPTION |
| 101 | + Arcs the turtle to the left (counter-clockwise) a number of degrees. |
| 102 | + |
| 103 | + For each degree, the turtle will move forward and rotate. |
| 104 | +.NOTES |
| 105 | + The amount moved forward will be the portion of the circumference. |
| 106 | +#> |
| 107 | +param( |
| 108 | +# The radius of a the circle, were it to complete the arc. |
| 109 | +[double] |
| 110 | +$Radius = 10, |
| 111 | + |
| 112 | +# The angle of the arc |
| 113 | +[double] |
| 114 | +$Angle = 60 |
| 115 | +) |
| 116 | + |
| 117 | +# Rather than duplicate logic, we will simply reverse the angle |
| 118 | +$angle *= -1 |
| 119 | +# and arc to the "right". |
| 120 | +return $this.ArcRight($Radius, $Angle) |
| 121 | + </Script> |
| 122 | + </ScriptMethod> |
| 123 | + <ScriptMethod> |
| 124 | + <Name>ArcRight</Name> |
| 125 | + <Script> |
| 126 | + <# |
| 127 | +.SYNOPSIS |
| 128 | + Arcs the turtle to the right |
| 129 | +.DESCRIPTION |
| 130 | + Arcs the turtle to the right (clockwise) a number of degrees. |
| 131 | + |
| 132 | + For each degree, the turtle will move forward and rotate. |
| 133 | +.NOTES |
| 134 | + The amount moved forward will be the portion of the circumference. |
| 135 | +#> |
| 136 | +param( |
| 137 | +# The radius of a the circle, were it to complete the arc. |
| 138 | +[double] |
| 139 | +$Radius = 10, |
| 140 | + |
| 141 | +# The angle of the arc |
| 142 | +[double] |
| 143 | +$Angle = 60 |
| 144 | +) |
| 145 | + |
| 146 | + |
| 147 | +# Determine the absolute angle, for this |
| 148 | +$absAngle = [Math]::Abs($angle) |
| 149 | +$circumferenceStep = ([Math]::PI * 2 * $Radius) / $absAngle |
| 150 | + |
| 151 | +$iteration = $angle / [Math]::Floor($absAngle) |
| 152 | +$angleDelta = 0 |
| 153 | +$null = while ([Math]::Abs($angleDelta) -lt $absAngle) { |
| 154 | + $this.Forward($circumferenceStep) |
| 155 | + $this.Rotate($iteration) |
| 156 | + $angleDelta+=$iteration |
| 157 | +} |
| 158 | + |
| 159 | +return $this |
| 160 | + </Script> |
| 161 | + </ScriptMethod> |
86 | 162 | <ScriptMethod>
|
87 | 163 | <Name>Backward</Name>
|
88 | 164 | <Script>
|
|
0 commit comments