Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing with dragon curve fractal
#1
Playing around with doing a dragon curve fractal, altering the looks of it, making it animated, produced an interesting effect.  Uses a recursive SUB.

- Dav

Code: (Select All)
'dragoncurve.bas
'A play on a dragon curve fractal
'Adapted by Dav, OCT/2023

Screen _NewImage(800, 600, 32)
Dim Shared a, p: p = .001
Do
    Cls: dragon 400, 300, 90 + (a * 3), a, 16
    If a < 200 Then a = a + .15
    If p < .002 Then p = p + .00000001
    _Limit 15: _Display
Loop Until _KeyHit


Sub dragon (x, y, size, ang, depth)
    If depth < 1 Then
        PSet (x, y), _RGBA(50, 150, 255, 50 + Rnd * 200)
    Else
        size2 = size / 1.414214: ang2 = ang - _Pi / p
        dragon x, y, size2, ang + _Pi / p, depth - 1
        dragon x + size2 * Cos(ang), y + size2 * Sin(ang), size2, ang2, depth - 1
    End If
End Sub

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
Playing with dragon curve fractal - by Dav - 10-06-2023, 06:25 PM
RE: Playing with dragon curve fractal - by bplus - 10-06-2023, 08:41 PM
RE: Playing with dragon curve fractal - by Dav - 10-06-2023, 09:08 PM
RE: Playing with dragon curve fractal - by Dav - 10-07-2023, 02:25 AM
RE: Playing with dragon curve fractal - by bplus - 10-07-2023, 12:05 PM
RE: Playing with dragon curve fractal - by Dav - 10-08-2023, 06:21 PM
RE: Playing with dragon curve fractal - by bplus - 10-08-2023, 06:44 PM
RE: Playing with dragon curve fractal - by Dav - 10-08-2023, 07:00 PM
RE: Playing with dragon curve fractal - by Dav - 10-09-2023, 12:23 AM



Users browsing this thread: 14 Guest(s)