Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just 6 Fractals
#7
(05-19-2022, 05:38 PM)TarotRedhand Wrote: @bplus Are you aware of these fractals in QB64 over on RosettaCode?

Barnsley Fern
Fractal Tree
Cantor Set (prettier than mine)
Hilbert Curve
Pythagoras Tree
Serpinski Carpet

All QB64 code on RosettaCode.

FWIW all QBasic code on RosettaCode.

TR

Yeah yeah...  ho hum old stuff! Oh have I got a Hilbert mod for you!

Code: (Select All)
_Title "Hilbert in His Curve" '2021-04-14 B+
' using AndyA's code for Hilbert Curve  and Wiki image of Hilbert

Const wide = 128, cell = 4 ' screen width 512 = height
Screen _NewImage(wide * cell + cell, wide * cell + cell, 32)
ReDim Shared As Long H, I
H = _NewImage(wide * cell + cell, wide * cell + cell, 32)
I = _LoadImage("Hilbert.PNG")
_PutImage , I, H
'Color , &HFFFFFFFF     'nope black still works better!
'Cls
PSet (wide * cell, wide * cell) 'prime pump
Hilbert 0, 0, wide, 0, 0
Sleep
System

Sub Hilbert (x As Integer, y As Integer, lg As Integer, p As Integer, q As Integer)
    Dim As Integer iL, iX, iY
    Dim As _Unsigned Long K
    iL = lg: iX = x: iY = y
    _Source H
    If iL = 1 Then
        K = Point((wide - iX) * cell, (wide - iY) * cell)
        Line -((wide - iX) * cell, (wide - iY) * cell), K
        Exit Sub
    End If
    iL = iL \ 2
    Hilbert iX + p * iL, iY + p * iL, iL, p, 1 - q
    Hilbert iX + q * iL, iY + (1 - q) * iL, iL, p, q
    Hilbert iX + (1 - p) * iL, iY + (1 - p) * iL, iL, p, q
    Hilbert iX + (1 - q) * iL, iY + q * iL, iL, 1 - p, q
End Sub

   


Attached Files
.zip   Hilbert in His Curve.zip (Size: 851.69 KB / Downloads: 133)
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Just 6 Fractals - by TarotRedhand - 05-08-2022, 09:41 AM
RE: Just 6 Fractals - by bplus - 05-08-2022, 04:47 PM
RE: Just 6 Fractals - by TarotRedhand - 05-08-2022, 06:04 PM
RE: Just 6 Fractals - by TarotRedhand - 05-09-2022, 09:34 AM
RE: Just 6 Fractals - by bplus - 05-09-2022, 11:31 AM
RE: Just 6 Fractals - by TarotRedhand - 05-19-2022, 05:38 PM
RE: Just 6 Fractals - by bplus - 05-19-2022, 06:02 PM
RE: Just 6 Fractals - by bplus - 05-19-2022, 06:07 PM
RE: Just 6 Fractals - by bplus - 05-19-2022, 08:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My old Turtle Graphics Fractals triggered 9 2,199 06-03-2022, 07:07 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)