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: 46)
b = b + ...
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



Users browsing this thread: 1 Guest(s)