Posted: 01:32am 04 Aug 2020 |
|
|
|
Cool thread, there's some other recursive line fractals I'd like to try if I get time (I think I was inspired by one called the koch curve and I changed things around and got a new one with a kind of hexagonal pattern).
Update: I gave it a quick try by modifying the Sierpinski program above. The rounding errors were already spoiling it before I got as much detail as I wanted. Here's the code I used:
' Hex Gasket Recursive Fractal
Mode 1,8
Colour 0,RGB(255,255,255)
Turtle Reset Turtle Pen Up Turtle Move 70,575 Turtle Turn Right 90 Turtle Pen Down
Turtle Pen Colour 0
'Gasket(650,7)
Gasket(650,5)
End
Sub Gasket(Length,Level)
If Level = 0 Then Turtle Forward Length ' Pause(50) Exit Sub EndIf
Turtle Pen Up Turtle Forward Length Turtle Pen Down
Turtle Turn Left 120
Gasket(Length / 2.0, Level - 1)
Turtle Turn Left 60
Gasket(Length / 2.0, Level - 1)
Turtle Turn Left 60
Gasket(Length / 2.0, Level - 1)
Turtle Turn Left 120
Turtle Pen Up Turtle Forward Length Turtle Pen Down End Sub
I changed the program to exactly retrace the same lines when going backwards, rather than taking a shortcut. It's more complicated, but it cancels out the rounding errors:
' Hex Gasket Recursive Fractal
Mode 1,8
Colour 0,RGB(255,255,255)
Turtle Reset Turtle Pen Up Turtle Move 70,575 Turtle Turn Right 90 Turtle Pen Down
Turtle Pen Colour 0
'Gasket(650,7)
Gasket(650,10)
End
Sub Gasket(Length,Level)
If Level = 0 Then Turtle Forward Length
Turtle Pen Up Turtle Backward Length Turtle Pen Down
' Pause(50) Exit Sub EndIf
Turtle Turn Left 60
Turtle Pen Up Turtle Forward Length/2 Turtle Pen Down Turtle Turn Right 180 Gasket(Length / 2.0, Level - 1) Turtle Turn Left 180
Turtle Turn Right 60
Turtle Pen Up Turtle Forward Length/2 Turtle Pen Down Turtle Turn Right 180 Gasket(Length / 2.0, Level - 1) Turtle Turn Left 180
Turtle Turn Right 60
Turtle Pen Up Turtle Forward Length/2 Turtle Pen Down Turtle Turn Right 180 Gasket(Length / 2.0, Level - 1) Turtle Turn Left 180
Turtle Pen Up
Turtle Turn Right 180 Turtle Forward Length/2
Turtle Turn Left 60 Turtle Forward Length/2
Turtle Turn Left 60 Turtle Forward Length/2
Turtle Turn Right 60 Turtle Turn Right 180
Turtle Pen Down
End Sub
|