<div align="justify">
<p>This example renders a classical well known <a href="http://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot</a>'s fractal. That can't be written as a simple expression and shows the possibilities of this little application.</p>
<h4>Command:</h4>
<pre>image 400 400 '
x0 = (x/w) / 3000 - 1.2499
y0 = (y/h) / 3000 - 0.07
a = 0
b = 0
iteration = 0
max_iteration = 1024
while ( (a^2 + b^2) <= 4 && iteration < max_iteration ) {
atemp = a*a - b*b + x0
b = 2*a*b + y0
a = atemp
iteration += 1
}
if ( iteration == max_iteration ) color = 0 else {
color = mod( iteration, 256 ) / 255
}
color' f0f,00f,0ff,ff0,f00 > mandelbrot.xpm</pre>
<p>If you want to see the full Mandelbrot picture, set:</p>
<ul>
<li><code>x0 = x*3.5/w - 2.5</code></li>
<li><code>y0 = y*2/h - 1</code></li>
</ul>
</div>
0sem comentários ainda