Author Topic: Expansion of the Mandelbrot set animations of Tomaaz  (Read 4052 times)

Manuel

  • Guest
Expansion of the Mandelbrot set animations of Tomaaz
« on: February 18, 2013, 01:44:00 AM »
Hi all.
I am Spanish and my level of writing in English is very poor, I used google translate to write this.
On February 5 I found in the post of Tomaaz http://forum.basicprogramming.org/index.php/topic, 2450.60.html, their animation of the Mandelbrot set and decided to join the 7 modify its behalf to give real-time functionality. The resolution is 1024x768 my version, but does not change the actual in which calculations are performed (320x240) and (240x160) transforming points squares or circles, You can also change the size of the print area simulating other resolutions and although this not improve performance recreates the original run of the animations. It has a complete description of the use of the keyboard (F1). and the possibility of data entry for a new animation.

Tomaaz, if you read this post please, how you calculate values of przesy and przesx?
Because I tried to modify them to fit the animations to other resolutions and the results have been disastrous. See the animation 8 program to check what is going wrong.

A small video: http://youtu.be/Ytp1uXtkRx8

and download the executable, source code and images:
http://www.mediafire.com/?008j9srj17tk8k7

Tomaaz

  • Guest
Re: Expansion of the Mandelbrot set animations of Tomaaz
« Reply #1 on: February 20, 2013, 01:10:43 PM »
Hi! I've seen your post on bp.org forum but couldn't reply, because I'm banned there. Do yo mean the predefined values of przesx and przesy? To be honest I don't remember how I calculated them. I was playing with Mandelbrot Set a lot some time ago and those values are result of it, but I don't remember any details. They are calculated for specific screen resolution (240x160) and won't work with other resolutions. Of course, it's possible to recalculate them, so they would work with other screen resolutions. Here is a version that ask for the width of the screen first:

Code: [Select]
dim as integer  x, y, c, stat, xm, ym, przyc
dim as double a, b, z, a2, b2, x2, y2, x3, y3, przesx, przesy, przelx, przely, pow, maxpow, szer, wys

screen 11
cls
print
input " Width? ", szer
wys = (szer / 3) * 2

screenres szer, wys, 32
windowtitle "Mandelbrot Set"

do
    read przesx
    przesx = przesx * (szer / 240)
    read przesy
    przesy = przesy * (wys / 160)
    read maxpow
    read pow
if pow = 2 then
restore
end if
    while (pow < maxpow)
        screenlock ()
        przelx = 3 / (szer * pow)
        przely = 2 / (wys * pow)
        for x = 0 to szer - 1
x3 = x - (szer / 2)
            for y = 0 to wys - 1
y3 = y - (wys / 2)
                a = 0
                b = 0
                c = 0
                x2 = (przelx * (x3 + (przesx * pow))) - 2
                y2 = (przely * (y3 + (przesy * pow))) - 1
                while (c < 255)
                    a2 = a * a - b * b
                    b2 = 2 * a * b
                    a = a2 + x2
                    b = b2 + y2
                    z = a * a + b * b
                    if z >= 4 then
                        exit while
                    end if
                    c = c + 1
                wend
if c = 255 then
pset (x, y), rgb (0, 0, 0)
else
pset (x, y), rgb (255 - c, (c mod 50) * 5, c)
end if
            next
        next
        if asc(inkey) = 255 then
screenunlock()
exit do
end if
pow = pow + pow * 0.04
        screenunlock()
        sleep 1
    wend
loop
end

data 14.17799995, 79.999904, 50 ^ 7, 1, 193.07, 97, 50 ^ 3, 4, 141.098, 11.145, 50 ^ 3, 2


BTW This place is about NaaLaa, EGSL and retro games in other languages, so, if you want to talk about Mandelbrot in FreeBASIC, we probably should move our conversation to pm or email (I don't want to be banned on this forum, too ;)).
« Last Edit: February 20, 2013, 01:14:05 PM by Tomaaz »