Pages

Followers

Powered by Blogger.

Tuesday, February 4, 2014

Fractals: One of my favorite topics, they are so stunning and they are easy to program. The most basic fractal I know is the MandelBrot set named by Benoit Mandelbrot.



Within the confines of Prog1 course of my university we coded a simple static Mandelbrot display software using Qt (that was my first encounter with this lovable framework). I was amazed but that wasn't enough for me, I WANTED MORE! :)

The best thing about fractals that they can be zoomed as deep as you want (and as the code precision allows)! So I decided to transform this code into a zoomer code.

The result was this strongly "spartan" code, but it's working (Shuffle's dictionary - I use the "spartan" code expression for those codes where I don't care about look and mobility of code, just code fast, run it one or two times and forget it - I have stolen this expression from my Prog1 course lecturer).

[Sorry, it uses Hungarian words, if you don't understand anything ask it from your best friend! :)]

This video is rendered by my code (with a little editing):

That's enough (or even too much) for introduction. The cash you are here for are the tips for your zoomer. Let's begin!

The tips

1. How deep can I zoom?
It depends on the precision you use. I recommend double precision for beginners.
If you want zoom deeper you should use Arbitrary-Precision (or Infinite Precision)!
 
2. How to count the zoom ratio?
I use a variable for counting "zoom step", actually I use this number for numbering frames too. Define this variable like this: 
int frameCount 1; //avoid using of zero

Now if your zoom number increments linearly you will experience that zooming is "slowing down" if you go deeper, so you should use an exponentially growing zoom number, this is what you have to use later:

double zoom = pow( 1.02, frameCount );

zoom = (1.02^frameCount)

The constant number 1.02 specifies the zooming speed. If you change it to a bigger number, the zooming will be faster.

<To be continued...>


Monday, February 3, 2014

Welcome to my coding blog!

I decided to share my experiences in this virtual word on this blog.

Enjoy the content! Enjoy coding!