File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,30 @@ $this.ViewBox = 0
245
245
return $this
246
246
</Script >
247
247
</ScriptMethod >
248
+ <ScriptMethod >
249
+ <Name >Distance</Name >
250
+ <Script >
251
+ < #
252
+ .SYNOPSIS
253
+ Determines the distance to a point
254
+ .DESCRIPTION
255
+ Determines the distance from the turtle's current position to a point.
256
+ #>
257
+ param(
258
+ # The X-coordinate
259
+ [double]$X = 0,
260
+ # The Y-coordinate
261
+ [double]$Y = 0
262
+ )
263
+
264
+ # Determine the delta from the turtle's current position to the specified point
265
+ $deltaX = $this.Position.X - $X
266
+ $deltaY = $this.Position.Y - $Y
267
+ # Calculate the distance using the Pythagorean theorem
268
+ return [Math]::Sqrt($deltaX * $deltaX + $deltaY * $deltaY)
269
+
270
+ </Script >
271
+ </ScriptMethod >
248
272
<ScriptMethod >
249
273
<Name >FillColor</Name >
250
274
<Script >
You can’t perform that action at this time.
0 commit comments