File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1189,6 +1189,32 @@ return $this.LSystem('F', [Ordered]@{
1189
1189
return "$($this.SVG.OuterXml)"
1190
1190
</Script >
1191
1191
</ScriptMethod >
1192
+ <ScriptMethod >
1193
+ <Name >Towards</Name >
1194
+ <Script >
1195
+ < #
1196
+ .SYNOPSIS
1197
+ Determines the angle towards a point
1198
+ .DESCRIPTION
1199
+ Determines the angle from the turtle's current position towards a point.
1200
+ #>
1201
+ param(
1202
+ # The X-coordinate
1203
+ [double]$X = 0,
1204
+ # The Y-coordinate
1205
+ [double]$Y = 0
1206
+ )
1207
+
1208
+ # Determine the delta from the turtle's current position to the specified point
1209
+ $deltaX = $this.Position.X - $X
1210
+ $deltaY = $this.Position.Y - $Y
1211
+ # Calculate the angle in radians and convert to degrees
1212
+ $angle = [Math]::Atan2($deltaY, $deltaX) * 180 / [Math]::PI
1213
+ # Return the angle rotate by 90 to account for the turtle's coordinate system
1214
+ return $angle + 90
1215
+
1216
+ </Script >
1217
+ </ScriptMethod >
1192
1218
<ScriptMethod >
1193
1219
<Name >TwinDragonCurve</Name >
1194
1220
<Script >
You can’t perform that action at this time.
0 commit comments