EvilZone

Programming and Scripting => Java => : Deque July 12, 2013, 12:47:48 PM

: [Java Release] Mandelbrot set viewer
: Deque July 12, 2013, 12:47:48 PM
Mandelbrot set viewer

The mandelbrot set was invented by Benoit Mandelbrot in 1970, who wanted to classify the Julia sets with it.
It is the set of all complex numbers c for which the following sequence remains bounded:

(https://upload.wikimedia.org/math/1/6/8/1686ce42df2b6ee51a3ae880613ca4d9.png)

Starting with z0 = 0.

In practice you will calculate the numbers for the sequence for up to 100 or 300 iterations and if it remained bounded the pixel is colored black, otherwise white.

This will look like this. The y-axis is the imaginary part, the x-axis is the real part:

(https://upload.wikimedia.org/wikipedia/commons/5/56/Mandelset_hires.png)


I did the same and colored the output, so I got this:

(http://s1.directupload.net/images/130711/oym8599b.png) (http://www.directupload.net)

In addition the viewer allows you to zoom in. Theoretically this works indefenitely, but in practice there is a limit.
Just drag a rectangle with your mouse from up left to down right. You might find some gems this way.

(http://s1.directupload.net/images/130711/kri94de5.png) (http://www.directupload.net)

I improved the coloring and got more smooth colors. See example pictures below for the current look.
I am still working on a good colormap, though.

(http://s7.directupload.net/images/130712/wcnanupi.png) (http://www.directupload.net)

(http://s14.directupload.net/images/130712/mh7ipvjo.png) (http://www.directupload.net)

(http://s7.directupload.net/images/130712/ggle4yj8.png) (http://www.directupload.net)

Usage:
Press s to save the current pictures as png in the current folder.
Drag with the mouse to zoom in.
Press r to zoom out.
To change init hue and hue factor press the update button.

Lines of code (by now): 250
Source on github: snip
Download program: http://uppit.com/h2dxfdtnruen/mandelbrot.jar
 (http://uppit.com/h2dxfdtnruen/mandelbrot.jar)

If you find some gems with the tool, share them here. :)
: Re: [Java Release] Mandelbrot set viewer
: proxx July 12, 2013, 01:32:42 PM
WOW.
I dont understand any of it but this is just awesome.
(she is married isnt she?)
+1
: Re: [Java Release] Mandelbrot set viewer
: Deque July 13, 2013, 07:51:10 PM
Experimented a bit with the colors. Here are some more pictures:


(http://s7.directupload.net/images/130713/v24myofl.png) (http://www.directupload.net)

(http://s7.directupload.net/images/130713/7kxcmqeu.png) (http://www.directupload.net)

(http://s14.directupload.net/images/130713/mce9bml6.png) (http://www.directupload.net)

(http://s7.directupload.net/images/130713/ehvrd5x5.png) (http://www.directupload.net)

Download link is updated to a newer version.

I am going to create a UI where you can change some color settings.
: Re: [Java Release] Mandelbrot set viewer
: vezzy July 13, 2013, 08:01:17 PM
Indeed, the quintessential example of a fractal. Nice job.
: Re: [Java Release] Mandelbrot set viewer
: geXXos July 13, 2013, 09:06:31 PM
@ Proxx
Neither do i, but is amazing, +1 Deque

: Re: [Java Release] Mandelbrot set viewer
: Kulverstukas July 13, 2013, 10:26:27 PM
Damn these are some trippy images :) +1 to deque!
: Re: [Java Release] Mandelbrot set viewer
: frog July 14, 2013, 08:59:51 AM
I like your code deque, it's clean; easy to read. I looked at a similar program written in C on http://thoughtcrime.org(awesome site btw) and it's at least twice the code. Nice work playa.
: Re: [Java Release] Mandelbrot set viewer
: Psycho_Coder July 14, 2013, 07:56:31 PM
Great article mam. By the way I found you here finally ;)
: Re: [Java Release] Mandelbrot set viewer
: Deque July 15, 2013, 07:49:00 PM
Thanks for your feedback.
I am working on a GUI, but it isn't as much fun as doing the logic.

I like your code deque, it's clean; easy to read. I looked at a similar program written in C on http://thoughtcrime.org (http://thoughtcrime.org)(awesome site btw) and it's at least twice the code. Nice work playa.

Thanks, but I think it is hard to compare. C needs more lines of code than Java because it is on a lower level.
I counted them with cloc, there are 590 LOC for the C project.

Great article mam. By the way I found you here finally ;)

Stalker. :D
I hope people don't mistake you for being me, because you have my previous avatar.
: Re: [Java Release] Mandelbrot set viewer
: Psycho_Coder July 15, 2013, 08:07:18 PM
Stalker. :D
I hope people don't mistake you for being me, because you have my previous avatar.


;) Having a little fun :)
: Re: [Java Release] Mandelbrot set viewer
: frog July 16, 2013, 04:11:58 AM
Hey where's all my cookies?
: Re: [Java Release] Mandelbrot set viewer
: Deque July 16, 2013, 04:26:34 PM
Hey where's all my cookies?

(https://sanseverything.files.wordpress.com/2007/11/cookie-monster3.jpg)
: Re: [Java Release] Mandelbrot set viewer
: frog July 17, 2013, 03:19:09 AM
Shit.