We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Turtle.Towards
1 parent f4cc8e3 commit 5331444Copy full SHA for 5331444
Types/Turtle/Towards.ps1
@@ -0,0 +1,20 @@
1
+<#
2
+.SYNOPSIS
3
+ Determines the angle towards a point
4
+.DESCRIPTION
5
+ Determines the angle from the turtle's current position towards a point.
6
+#>
7
+param(
8
+# The X-coordinate
9
+[double]$X = 0,
10
+# The Y-coordinate
11
+[double]$Y = 0
12
+)
13
+
14
+# Determine the delta from the turtle's current position to the specified point
15
+$deltaX = $this.Position.X - $X
16
+$deltaY = $this.Position.Y - $Y
17
+# Calculate the angle in radians and convert to degrees
18
+$angle = [Math]::Atan2($deltaY, $deltaX) * 180 / [Math]::PI
19
+# Return the angle rotate by 90 to account for the turtle's coordinate system
20
+return $angle + 90
0 commit comments