diff --git a/Build/Turtle.GitHubAction.PSDevOps.ps1 b/Build/Turtle.GitHubAction.PSDevOps.ps1 index 352cb31..c540eb9 100644 --- a/Build/Turtle.GitHubAction.PSDevOps.ps1 +++ b/Build/Turtle.GitHubAction.PSDevOps.ps1 @@ -5,6 +5,6 @@ Import-BuildStep -SourcePath ( $PSScriptRoot | Split-Path | Push-Location -New-GitHubAction -Name "TurtlePower" -Description 'Turtles in a PowerShell' -Action TurtleAction -Icon chevron-right -OutputPath .\action.yml +New-GitHubAction -Name "TurtlePowerShell" -Description 'Turtles in a PowerShell' -Action TurtleAction -Icon chevron-right -OutputPath .\action.yml Pop-Location \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..176988a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,68 @@ +## Turtle 0.1.1: + +* Updates: + * `Turtle.get/set_ID` allows for turtle identifiers + * `Turtle.ToString()` stringifies the SVG +* Fixes: + * Fixing GoTo/Teleport (#90) + * Fixing Position default (#85) (thanks @ninmonkey !) + * Fixing Turtle Action ID (#89) +* New: + * `Turtle.Push()` pushes position/heading to a stack (#91) + * `Turtle.Pop()` pops position/heading from a stack (#92) + * `Turtle.get_Stack` gets the position stack (#93) +* New Fractals: + * `BinaryTree()` (#94) + * `FractalPlant()` (#95) + +--- + +## Turtle 0.1: + +* Initial Release +* Builds a Turtle Graphics engine in PowerShell +* Core commands + * `Get-Turtle` (alias `turtle`) runs multiple moves + * `New-Turtle` create a turtle + * `Move-Turtle` performas a single move + * `Set-Turtle` changes a turtle + * `Save-Turtle` saves a turtle + +~~~PowerShell +turtle Forward 10 Rotate 120 Forward 10 Roate 120 Forward 10 Rotate 120 | + Set-Turtle Stroke '#4488ff' | + Save-Turtle ./Triangle.svg +~~~ + +* Core Object + * `.Heading` controls the turtle heading + * `.Steps` stores a list of moves as an SVG path + * `.IsPenDown` controls the pen + * `.Forward()` moves forward at heading + * `.Rotate()` rotates the heading + * `.Square()` draws a square + * `.Polygon()` draws a polygon + * `.Circle()` draws a circle (or partial circle) +* LSystems + * Turtle can draw a L system. Several are included: + * `BoxFractal` + * `GosperCurve` + * `HilbertCurve` + * `KochCurve` + * `KochIsland` + * `KochSnowflake` + * `MooreCurve` + * `PeanoCurve` + * `SierpinskiTriangle` + * `SierpinskiCurve` + * `SierpinskiSquareCurve` + * `SierpinskiArrowheadCurve` + * `TerdragonCurve` + * `TwinDragonCurve` + +~~~PowerShell +turtle SierpinskiTriangle 10 4 | + Set-Turtle Stroke '#4488ff' | + Save-Turtle ./SierpinskiTriangle.svg +~~~ + diff --git a/Examples/BoxFractal.svg b/Examples/BoxFractal.svg index ddf0ef3..0c6a946 100644 --- a/Examples/BoxFractal.svg +++ b/Examples/BoxFractal.svg @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Examples/EndlessBoxFractal.svg b/Examples/EndlessBoxFractal.svg index e17ad74..a0f3f41 100644 --- a/Examples/EndlessBoxFractal.svg +++ b/Examples/EndlessBoxFractal.svg @@ -6,7 +6,7 @@ - + diff --git a/Examples/EndlessHilbert.svg b/Examples/EndlessHilbert.svg index 81b1ddb..c130204 100644 --- a/Examples/EndlessHilbert.svg +++ b/Examples/EndlessHilbert.svg @@ -6,7 +6,7 @@ - + diff --git a/Examples/EndlessSierpinskiTrianglePattern.svg b/Examples/EndlessSierpinskiTrianglePattern.svg index 02e75bf..0f93759 100644 --- a/Examples/EndlessSierpinskiTrianglePattern.svg +++ b/Examples/EndlessSierpinskiTrianglePattern.svg @@ -6,7 +6,7 @@ - + diff --git a/Examples/EndlessSnowflake.svg b/Examples/EndlessSnowflake.svg index 67f9356..17575f2 100644 --- a/Examples/EndlessSnowflake.svg +++ b/Examples/EndlessSnowflake.svg @@ -6,7 +6,7 @@ - + diff --git a/Examples/SierpinskiTriangle.svg b/Examples/SierpinskiTriangle.svg index 9aa7e52..30b944f 100644 --- a/Examples/SierpinskiTriangle.svg +++ b/Examples/SierpinskiTriangle.svg @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Turtle.psd1 b/Turtle.psd1 index 6341e1c..0f46f0e 100644 --- a/Turtle.psd1 +++ b/Turtle.psd1 @@ -1,6 +1,6 @@ @{ # Version number of this module. - ModuleVersion = '0.1' + ModuleVersion = '0.1.1' # Description of the module Description = "Turtles in a PowerShell" # Script module or binary module file associated with this manifest. @@ -30,6 +30,25 @@ # A URL to the license for this module. LicenseURI = 'https://github.com/PowerShellWeb/Turtle/blob/main/LICENSE' ReleaseNotes = @' +## Turtle 0.1.1: + +* Updates: + * `Turtle.get/set_ID` allows for turtle identifiers + * `Turtle.ToString()` stringifies the SVG +* Fixes: + * Fixing GoTo/Teleport (#90) + * Fixing Position default (#85) (thanks @ninmonkey !) + * Fixing Turtle Action ID (#89) +* New: + * `Turtle.Push()` pushes position/heading to a stack (#91) + * `Turtle.Pop()` pops position/heading from a stack (#92) + * `Turtle.get_Stack` gets the position stack (#93) +* New Fractals: + * `BinaryTree()` (#94) + * `FractalPlant()` (#95) + +--- + ## Turtle 0.1: * Initial Release diff --git a/Turtle.types.ps1xml b/Turtle.types.ps1xml index 8b5ac9a..ba2fc30 100644 --- a/Turtle.types.ps1xml +++ b/Turtle.types.ps1xml @@ -98,6 +98,26 @@ $Distance = 10 $this.Forward($Distance * -1) + + + + BinaryTree + @@ -285,6 +305,26 @@ if ($This.IsPenDown) { return $this + + FractalPlant + + GosperCurve @@ -365,10 +405,10 @@ return $this [double]$Angle = 90 ) -return $this.LSystem('A', @{ +return $this.LSystem('A', [Ordered]@{ A = '+BF-AFA-FB+' B = '-AF+BFB+FA-' -}, $Order, @{ +}, $Order, [Ordered]@{ 'F' = { $this.Forward($Size) } '\+' = { $this.Rotate($Angle) } '\-' = { $this.Rotate($Angle * -1) } @@ -682,6 +722,12 @@ $null = foreach ($character in $finalState.ToCharArray()) { } } } +$this.PathAttribute = [Ordered]@{ + "data-l-order" = $N + "data-l-axiom" = $Axiom + "data-l-rules" = ConvertTo-Json $Rule + "data-l-expanded" = $finalState +} return $this @@ -798,6 +844,37 @@ $null = foreach ($n in 1..$SideCount) { $this.Forward($Size) $this.Rotate(360 / $SideCount) } +return $this + + + + Pop + + + + Push + @@ -1057,7 +1134,7 @@ $Y $deltaX = $x - $this.X $deltaY = $y - $this.Y $this.Steps += "m $deltaX $deltaY" -$this.Position = $x, $y +$this.Position = $deltaX, $deltaY return $this @@ -1104,6 +1181,14 @@ return $this.LSystem('F', [Ordered]@{ + + ToString + + TwinDragonCurve