1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| Public Function Simple_Mandel()
minX = -2.4: maxX = 2.4
minY = -1.5: maxY = 1.5
w = Me.ScaleWidth: h = Me.ScaleHeight
DoEvents
If Touche <> 0 Then Exit Function
For x = 0 To w - 1
rc = minX + (maxX - minX) / w * x
For y = 0 To h - 1
ic = minY + (maxY - minY) / h * y
rz = 1
iz = 0
For a = 1 To 29: Rem choix de 32 itérations
DoEvents
r = rz
i = iz
rz = r * r - i * i + rc
iz = 2 * r * i + ic
module = rz * rz + iz * iz
If module > 4 Then Exit For
Next a
PSet (x, y) , RGB(64, 10 * a Mod 255, 20 * a Mod 255)
Next y
Next x
While Touche = 0
DoEvents
Wend
End Function
Public Function JuliaSet()
Dim cRe As Double, cIm As Double
Dim newRe As Double, newIm As Double, oldRe As Double, oldIm As Double
Dim zoom As Double: zoom = 1
moveX = 0: moveY = 0
Dim color As Double
Dim maxIterations As Integer: maxIterations = 300
w = Me.ScaleWidth: h = Me.ScaleHeight
cRe = -0.7
cIm = 0.27015
Dim x As Integer, y As Integer
For x = 0 To w
For y = 0 To h
newRe = 1.5 * (x - w / 2) / (0.5 * zoom * w) + moveX
newIm = (y - h / 2) / (0.5 * zoom * h) + moveY
Dim i As Integer
For i = 0 To maxIterations
oldRe = newRe
oldIm = newIm
newRe = oldRe * oldRe - oldIm * oldIm + cRe
newIm = 2 * oldRe * oldIm + cIm
'if the point is outside the circle with radius 2: stop
If ((newRe * newRe + newIm * newIm) > 4) Then Exit For
Next i
color = RGB(255 Mod (i * 30 + 1), 255 Mod (i + 1), 20 * i) '< maxIterations))
PSet (x, y), color
Next y, x
Me.Refresh
End Function |
Partager