The beauty of z^2 + c
Posted: Sun Jun 25, 2006 6:25 pm
Code updated For 5.20+
Found this a year ago while experimenting with Mandelbrot's set. Just
animated it a bit. Enjoy!
(if it stops, just move the cursor over the window)
Found this a year ago while experimenting with Mandelbrot's set. Just
animated it a bit. Enjoy!
(if it stops, just move the cursor over the window)
Code: Select all
#S = 512
img = CreateImage(#PB_Any, #S, #S)
OpenWindow(0, 200, 200, #S, #S, "Test")
; CreateGadgetList(WindowID(0))
ImageGadget(0, 0, 0, #S, #S, ImageID(img))
anzFelder.l = #S
aktseite.f = 2.5
ecke_re.f = -1.65
ecke_im.f = -1.25
spalt.f = aktseite / anzFelder
Repeat
StartDrawing(ImageOutput(img))
Box(0, 0, anzFelder, anzFelder, 0)
ecke_re + 0.0001
For n.l = 0 To anzFelder - 1 Step 11
c_re.f = ecke_re + n * spalt
For m.l = 0 To anzFelder - 1 Step 11
c_im.f = ecke_im + m * spalt
z_re.f = 0
z_im.f = 0
zaehler.l = 0
Repeat
t.f = 2 * z_re * z_im + c_im
z_re = z_re * z_re - z_im * z_im + c_re
z_im = t
x = (z_re - ecke_re) / spalt
y = (z_im - ecke_im) / spalt
If x < #S And y < #S And x >= 0 And y >= 0
Plot(x, y, zaehler * 1.27)
EndIf
zaehler + 1
Until zaehler > 200
Next
Next
StopDrawing()
SetGadgetState(0, ImageID(img))
Until WaitWindowEvent() = #PB_Event_CloseWindow