File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -473,22 +473,31 @@ return $this
473
473
Draws a flower pattern in turtle graphics.
474
474
475
475
This pattern consists of a series of polygons and rotations to create a flower-like design.
476
+ .EXAMPLE
477
+ turtle Flower 42
476
478
.EXAMPLE
477
- $turtle = New-Turtle
478
- $turtle.Flower(100, 10, 5, 36)
479
- $turtle.Pattern.Save("$pwd/FlowerPattern.svg")
479
+ turtle Flower 42 20 6 18
480
480
.EXAMPLE
481
- Move-Turtle Flower |
482
- Save-Turtle ./FlowerSymbol.svg
481
+ turtle Flower 42 20 6 18
482
+ .EXAMPLE
483
+ # We can make Flowers with partial polygons
484
+ turtle Flower 42 20 6.6 18
485
+ .EXAMPLE
486
+ # They are surprisingly beautiful
487
+ turtle Flower 42 30 7.7 12
483
488
#>
484
489
param(
490
+ # The size of the base shape
485
491
[double]$Size = 100,
492
+ # The rotation after each step
486
493
[double]$Rotation = 10,
494
+ # The number of sides in each shape
487
495
[double]$SideCount = 4,
488
- [double]$StepCount = 36
496
+ # The number of steps in the flower.
497
+ [int]$StepCount = 36
489
498
)
490
499
491
- $null = foreach ($n in 1..$StepCount) {
500
+ $null = foreach ($n in 1..([Math]::Abs( $StepCount)) ) {
492
501
$this.Polygon($Size, $SideCount)
493
502
$this.Rotate($Rotation)
494
503
}
You can’t perform that action at this time.
0 commit comments