#Need help rendering a Mandelbrot set
1 messages · Page 1 of 1 (latest)
function check(cx, cy) {
var _x = 0;
var _y = 0;
var x2 = _x*_x;
var y2 = _y*_y;
var iter = 0;
while ((iter < max_iter) && ((x2 + y2) < 4.0))
{
_y = 2*_x*_y + cy;
_x = x2 - y2 + cx;
x2 = _x * _x;
y2 = _y * _y;
++iter;
}
return iter < max_iter;
}
ty will do when i get home
Good to see you got it working. Presumably you know if you return the iter value instead of a boolean you can try to convert it to a color, to get some kind of shading.
The more you zoom in on the border the more colorful that approach gets.
yes
will try
ill go do some reasearch
probably
make_color_rgb(cells[i][j] mod 256, 0, 0) will give a red shade. make_color_hsv(cells[i][j] mod 256, 255, 255) will do something across a color spectrum. Use that in draw_set_color() for each point you draw.
ok
im gonna modify the code so itll place the colors value for each pixel rather than just 0 or 1
wait so
nvm
im not gonna do that ill just do the thing in the draw event
wait im confused its getting what value is it meant to get from cells[i][j]
nvm
oh
it works
Cool.
I basically meant put either iter in the cells or the color, but seems like you figured that out.
i basicallty just made it return the iterations if its not in the set
-1 means its in the set
If you want to eliminate the squash vertically, change the range of -1.25 to 1.25 by multiplying the cy value passed into the check() function by room_height/room_width.
also i was planning on something like a way to zoom with gui but it runs too slow for that
takes a good few seconds to render one frame and like 20 to actually generate it
There are tons of ways to speed up, but involves a lot of code.
I stopped a long time ago trying to make a fast mandelbrot after I used fractint.
I'm sure there are other tools these days, using shaders and whatnot (although the precision needed to zoom becomes a headache, but maybe some smart person worked around that too).
very nice
Regardless of whether you pursue it further, it is always fun to have done it at least once.
Eh, your code was 95% there.