Skip to content

Commit 129f716

Browse files
feat: Turtle.Triplexity() ( Fixes #156 )
1 parent cf8ff4b commit 129f716

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Types/Turtle/Triplexity.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<#
2+
.SYNOPSIS
3+
Draws a Triplexity
4+
.DESCRIPTION
5+
Draws a Triplexity Fractal, using an L-System.
6+
7+
Each generation of the triplexity will create an equilateral triangle with a spoke and an incomplete total rotation.
8+
9+
Multiple generations of this seem to alternate between even numbered triangle shapes and odd numbered "lines" of triangles.
10+
.EXAMPLE
11+
turtle Triplexity 42 1
12+
.EXAMPLE
13+
turtle Triplexity 42 2
14+
.EXAMPLE
15+
turtle Triplexity 42 3
16+
.EXAMPLE
17+
turtle Triplexity 42 4
18+
#>
19+
param(
20+
# The size of each segment
21+
[double]$Size = 42,
22+
# The order of magnitude (the number of expansions)
23+
[int]$Order = 4,
24+
# The default angle.
25+
[double]$Angle = 60
26+
)
27+
return $this.LSystem('F++F++F', [Ordered]@{
28+
F = 'F++F++FFF'
29+
}, $Order, [Ordered]@{
30+
'\+' = { $this.Rotate($Angle) }
31+
'-' = { $this.Rotate($Angle*-1)}
32+
'F' = { $this.Forward($Size) }
33+
})

0 commit comments

Comments
 (0)