Post by matthew on Nov 11, 2006 14:31:30 GMT -5
This programme will display a simple Julia Fractal on your Screen.
The best thing is it only takes about a minute.
For some reason the programme isn't very responsive.
If you press the Escape key while the programme is running nothing will happen.
It only responds to the Escape key once it's finished drawing the Fractal.
The best thing is it only takes about a minute.
For some reason the programme isn't very responsive.
If you press the Escape key while the programme is running nothing will happen.
It only responds to the Escape key once it's finished drawing the Fractal.
OPTION Explicit
DIM AppRun : AppRun = TRUE
DIM Sx : Sx = 640
DIM Sy : Sy = 480
DIM XMin : XMin = -2
DIM XMax : XMax = 1.25
DIM YMin : YMin = -1.25
DIM YMax : YMax = 1.25
DIM MaxIter : MaxIter = 512
DIM OldX
DIM Fx, Fy
DIM Ix : Ix = 0.42
DIM Iy : IY = 0.23
DIM M
DIM DX : DX = ( XMax - XMin ) / Sx
DIM Dy : DY = ( YMax - YMin ) / Sy
DIM Px
DIM Py : Py = 0
DIM X1
DIM Y1 : Y1 = YMin
SUB Main()
IF (Graphics.Initialize <> TRUE) THEN EXIT SUB
Graphics.SetTitle "Simple Julia Fractal"
Key.Initialize
Graphics.Clear &h000000
While Py < Sy
Px = 0
X1 = XMin
Py = Py + 1
While Px < Sx
Px = Px + 1
Fx = X1
Fy = Y1
M = 0
Do While (((Fx * Fx + Fy * Fy) < 4) And (M < MaxIter))
OldX = Fx
Fx = Fx * Fx - Fy * FY + Ix
Fy = 2 * OldX * Fy + Iy
M = M + 1
Loop
Graphics.SetRect Px - 75, Py, 1, 1, ARGB(255, M, M, M)
System.ProcessMessages
X1 = X1 + Dx
Wend
Graphics.Display
Y1 = Y1 + Dy
System.ProcessMessages
Wend
Do While AppRun = TRUE
IF Key.Pressed(1) Or Key.Pressed(0) = TRUE THEN AppRun = FALSE
System.ProcessMessages
Loop
Graphics.Terminate
Key.Terminate
End SUB
CALL Main