File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -1320,6 +1320,56 @@ foreach ($n in 1..$Points) {
1320
1320
$this.Rotate($Angle)
1321
1321
}
1322
1322
1323
+ </Script >
1324
+ </ScriptMethod >
1325
+ <ScriptMethod >
1326
+ <Name >StepSpiral</Name >
1327
+ <Script >
1328
+ < #
1329
+ .SYNOPSIS
1330
+ Draws a step spiral
1331
+ .DESCRIPTION
1332
+ Draws a spiral as a series of steps.
1333
+
1334
+ Each step will draw a line, rotate, and increment the length of the next step.
1335
+
1336
+ By default, this creates an outward spiral.
1337
+
1338
+ To create an inward spiral, use a negative StepSize or StepCount.
1339
+ #>
1340
+ param(
1341
+ # The length of the first step
1342
+ [double]$Length = 1,
1343
+ # The angle to rotate after each step
1344
+ [double]$Angle = 90,
1345
+ # The amount of change per step
1346
+ [double]$StepSize = 1,
1347
+ # The number of steps.
1348
+ [int]$StepCount = 20
1349
+ )
1350
+
1351
+ # If the step size or count is negative
1352
+ if (
1353
+ ($stepSize -lt 0 -or $stepCount -lt 0) -and
1354
+ $Length -in 0,1 # and the length is either the default or zero
1355
+ ) {
1356
+ # set the length to the correct maximim step size, so we can make an inward spiral.
1357
+ $Length = ([Math]::Abs($stepSize) * [Math]::Abs($stepCount))
1358
+ }
1359
+ elseif ($length -eq 0) {
1360
+ # If the length is empty, default it to the step size
1361
+ $Length = $StepSize
1362
+ }
1363
+
1364
+ # Perform the appropriate steps
1365
+ foreach ($n in 1..([Math]::Abs($StepCount))) {
1366
+ $this = $this.Forward($length).Rotate($angle)
1367
+ $length += $stepSize
1368
+ }
1369
+ # and return ourself.
1370
+ return $this
1371
+
1372
+
1323
1373
</Script >
1324
1374
</ScriptMethod >
1325
1375
<ScriptMethod >
You can’t perform that action at this time.
0 commit comments