diff --git a/CHANGELOG.md b/CHANGELOG.md
index 07b53c5..e6c3839 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+## Turtle 0.1.5:
+
+* New Shapes:
+ * Scissor draws a pair of lines at an angle (#128)
+ * ScissorPoly draws a polygon out of scissors (#129)
+* Fixes:
+ * OffsetPath is now quoted (#130)
+ * ArcLeft/Right distance fix (#131)
+
+---
+
## Turtle 0.1.4
* `Turtle` Upgrades
diff --git a/Examples/EndlessScissorPoly.svg b/Examples/EndlessScissorPoly.svg
new file mode 100644
index 0000000..74d3ba9
--- /dev/null
+++ b/Examples/EndlessScissorPoly.svg
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/Examples/EndlessScissorPoly.turtle.ps1 b/Examples/EndlessScissorPoly.turtle.ps1
new file mode 100644
index 0000000..5a65480
--- /dev/null
+++ b/Examples/EndlessScissorPoly.turtle.ps1
@@ -0,0 +1,20 @@
+Push-Location $PSScriptRoot
+$turtle = turtle ScissorPoly 230 64 64 |
+ Set-Turtle -Property PatternTransform -Value @{scale=0.33} |
+ set-turtle -property Stroke -value '#224488' |
+ set-turtle -property Fill -value '#4488ff' |
+ Set-Turtle -Property FillRule -Value 'evenodd' |
+ Set-Turtle -Property PatternAnimation -Value ([Ordered]@{
+ type = 'scale' ; values = 1.33,0.66, 1.33 ; repeatCount = 'indefinite' ;dur = "23s"; additive = 'sum'
+ }, [Ordered]@{
+ type = 'rotate' ; values = 0, 360 ;repeatCount = 'indefinite'; dur = "41s"; additive = 'sum'
+ }, [Ordered]@{
+ type = 'skewX' ; values = -30,30,-30;repeatCount = 'indefinite';dur = "83s";additive = 'sum'
+ }, [Ordered]@{
+ type = 'skewY' ; values = 30,-30, 30;repeatCount = 'indefinite';additive = 'sum';dur = "103s"
+ }, [Ordered]@{
+ type = 'translate';values = "0 0","42 42", "0 0";repeatCount = 'indefinite';additive = 'sum';dur = "117s"
+ })
+
+$turtle | save-turtle -Path ./EndlessScissorPoly.svg -Property Pattern
+Pop-Location
\ No newline at end of file
diff --git a/Turtle.psd1 b/Turtle.psd1
index 68c522e..f3a2676 100644
--- a/Turtle.psd1
+++ b/Turtle.psd1
@@ -1,6 +1,6 @@
@{
# Version number of this module.
- ModuleVersion = '0.1.4'
+ ModuleVersion = '0.1.5'
# Description of the module
Description = "Turtles in a PowerShell"
# Script module or binary module file associated with this manifest.
@@ -37,24 +37,14 @@
# A URL to the license for this module.
LicenseURI = 'https://github.com/PowerShellWeb/Turtle/blob/main/LICENSE'
ReleaseNotes = @'
-## Turtle 0.1.4
+## Turtle 0.1.5:
-* `Turtle` Upgrades
- * `turtle` will return an empty turtle (#112)
- * `turtle` now splats to script methods, enabling more complex input binding (#121)
- * `LSystem` is faster and more flexible (#116)
-* New Properties:
- * `get/set_Opacity` (#115)
- * `get/set_PathAnimation` (#117)
- * `get/set_Width/Height` (#125)
-* New Methods:
- * `HorizontalLine/VerticalLine` (#126)
- * `Petal` (#119)
- * `FlowerPetal` (#124)
- * `Spirolateral` (#120)
- * `StepSpiral` (#122)
+* New Shapes:
+ * Scissor draws a pair of lines at an angle (#128)
+ * ScissorPoly draws a polygon out of scissors (#129)
* Fixes:
- * `Turtle.Towards()` returns a relative angle (#123)
+ * OffsetPath is now quoted (#130)
+ * ArcLeft/Right distance fix (#131)
---
diff --git a/Turtle.tests.ps1 b/Turtle.tests.ps1
index 62306f8..7eabdb5 100644
--- a/Turtle.tests.ps1
+++ b/Turtle.tests.ps1
@@ -19,6 +19,26 @@ describe Turtle {
$png[1..3] -as 'char[]' -as 'string[]' -join '' | Should -Be PNG
}
+ it 'Can draw an arc' {
+ $Radius = 1
+ $t = turtle ArcRight $Radius 360
+ $Heading = 180.0
+ [Math]::Round($t.Width,1) | Should -Be ($Radius * 2)
+ [Math]::Round($t.Heading,1) | Should -Be 360.0
+
+ $Radius = 1
+ $Heading = 180.0
+ $t = turtle ArcRight $Radius 180
+ [Math]::Round($t.Width,1) | Should -Be ($Radius * 2)
+ [Math]::Round($t.Heading,1) | Should -Be $Heading
+
+ $Radius = 1
+ $Heading = 90.0
+ $t = turtle ArcRight $Radius $Heading
+ [Math]::Round($t.Width,1) | Should -Be ($Radius * 4)
+ [Math]::Round($t.Heading,1) | Should -Be $Heading
+ }
+
context 'Turtle Directions' {
it 'Can tell you the way towards a point' {
diff --git a/Turtle.types.ps1xml b/Turtle.types.ps1xml
index 4a2a1bc..14e1618 100644
--- a/Turtle.types.ps1xml
+++ b/Turtle.types.ps1xml
@@ -151,19 +151,33 @@ $Radius = 10,
$Angle = 60
)
-
-# Determine the absolute angle, for this
+# Determine the absolute angle, for this operation
$absAngle = [Math]::Abs($angle)
-$circumferenceStep = ([Math]::PI * 2 * $Radius) / $absAngle
-$iteration = $angle / [Math]::Floor($absAngle)
-$angleDelta = 0
-$null = while ([Math]::Abs($angleDelta) -lt $absAngle) {
- $this.Forward($circumferenceStep)
- $this.Rotate($iteration)
+if ($absAngle -eq 0) { return $this }
+
+# Determine the circumference of a circle of this radius
+$Circumference = ((2 * $Radius) * [Math]::PI)
+
+# Clamp the angle, as arcs beyond 360 just continue to circle
+$ClampedAngle =
+ if ($absAngle -gt 360) { 360 }
+ elseif ($absAngle -lt -360) { -360}
+ else { $absAngle }
+# The circumference step is the circumference divided by our clamped angle
+$CircumferenceStep = $Circumference / [Math]::Floor($ClampedAngle)
+# The iteration is as close to one or negative one as possible
+$iteration = $angle / [Math]::Floor($absAngle)
+# Start off at iteration 1
+$angleDelta = $iteration
+# while we have not reached the angle
+while ([Math]::Abs($angleDelta) -le $absAngle) {
+ # Rotate and move forward
+ $null = $this.Rotate($iteration).Forward($CircumferenceStep)
$angleDelta+=$iteration
}
+# Return this so we can keep the chain.
return $this
@@ -1188,6 +1202,111 @@ return $this | Save-Turtle @saveSplat
+
+ Scissor
+
+
+
+ ScissorPoly
+
+
SierpinskiArrowheadCurve