Advertisement

the great mandelbrot set

Started by June 10, 2003 06:45 PM
34 comments, last by vanillacoke 21 years, 6 months ago
Just made a mandelbrot set program. I've done it before tons of times, but I have a new problem, the likes of which I've never seen before, really. When the width of the image gets down to about .00001 (in the complex plane), there are these weird black lines that don't get processed. It looks like my dx variable is slightly larger than it should be (so that the plane-scanning loop skips a few columns), but I've checked and rechecked that code, and that's not the problem. This is the first time I've ever done a mandelbrot prog in C++, and I think there might be a variable type problem. Does anyone have a similar experience or useful insight? Also, does anyone know of a cool, creative way to color the mandelbrot set? I know of these: -use iteration count along with some simple color table -use the final complex result of the iteration formula -use some combination of the final result of the iteration formula and the initial complex point The trick, I guess, is in coming up with a cool way to use one of those; taking it one step further. I've seen really awesome mandelbrot colorings, and sometimes I just have absolutely no clue how they are done. edit: fixing the color btw, does anyone know how the color hex codes work on this board? I assumed it was 0xrrggbb, but that is not the case. [edited by - vanillacoke on June 10, 2003 7:50:58 PM]
You know what I never noticed before?
I've made a couple of Mandelbrot generators before. As for colouring, I've always used the number of iterations, put through different function to generate the colour. Why not make this topic into show your best MandelBrot renderings. Here are my best and only surviving ones:

Pic 1
Pic 2
Pic 3
Pic 4
Pic 5

I like numbers 4 and 5 the best. Each one is zoomed in more than the last.

[edited by - higherspeed on June 10, 2003 8:17:57 PM]
Advertisement
I don''t have any pics, but here

http://kahuna.clayton.edu/~jbrooks/applets/mandelbrot/

is an applet I wrote a while back so you can make your own perty pictures.
higherspeed, those are nice, but they lack that extra edge, that one thing that no one else has... so does everything I make...
For that first picture, is that a normal generation technique? The boundaries between different iter-counts look kind of strange, not like how mine normally look.
You know what I never noticed before?
A friend of mine has had great success with animating mandelbrots...ie, you animate the value of c over time in your update.
For the mandelbrot set, with the equation Zn-1 = (Zn)^2 + c, you vary c over the rectangle. You could vary Z0 with time, that would make some interesting stuff. I actually did that about five minutes ago, but it was really crappy, linear, low-res, and not a movie, but a program. I''ve always wanted to do a movie where the zoom level varies with time, but I have to be able to store frames before I can do that, cuz when you zoom, it takes increasing time to generate, and my cpu is 533MHz and the program is not optimized at all. But I am sure that some day I will make such a program.
You know what I never noticed before?
Advertisement
quote: Original post by vanillacoke
... When the width of the image gets down to about .00001 (in the complex plane), there are these weird black lines that don''t get processed...


It is likely that you have reached the practical limit of the precision of a 32-bit float. From float.h:
#define FLT_EPSILON     1.192092896e-07F        /* smallest such that 1.0+FLT_EPSILON != 1.0 */ 


John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Like a "Jambolo" said i think it is a precison limit....

///------------------
I used some time ago the continiuos coloring, without sharp borders, i used it to render hi quality images.

inline double GetMandelDepth(RealValue MX, RealValue MY, int MaxDepth,
bool InsideColored, bool OutsideColored){
const RealValue OutLine=256.0;

RealValue XIter = MX;
RealValue YIter = MY;
RealValue XxX = MX*MX;
RealValue YxY = MY*MY;

int Steps = MaxDepth+1;

do{
YIter = XIter * YIter;
YIter += YIter + MY;

XIter = XxX - YxY + MX;
XxX = XIter * XIter;
YxY = YIter * YIter;

if((YxY + XxX) > OutLine)goto OutLabel;

}while(Steps--);

if(InsideColored) return double(MaxDepth*(XxX + YxY)/OutLine);
else return 0.0;

OutLabel:
//smoth rendering
if(OutsideColored){
double Fractional=pow(XxX + YxY,0.1);
Fractional=2.0-(Fractional-1.7411013062659082)/1.296005435557;
Fractional=(pow(Fractional,3)-1.0)/7.0;
MaxDepth-=Steps;
return fabs(double(MaxDepth)+Fractional);
}else return 0.0;
}
I haven''t looked into rendering the MandelBrot set for ages, but it would be nice to do movies, I tried ages ago, but my programming/computing skills always let me down. I think I may be able to manage now. As for the first picture, it just uses a standard circle of radius 2 for checking if the point has escaped. Each boundary is just the refinement of the set after each iteration.


Also 3D sets aren''t easily possible, but one interesting idea is using quaternions. A book I read had some renderings of 3D ''slices'' of the 4D mandelbrot set. It didn''t look all that impressive, but that''s mainly to do with our limited way of viewing it. It''s hard to represent a 3D set on a 2D page.


Once I''ve finished my current project I think I''ll make a Julia sets renderer, with a changing c value. It would be especially nice to trace the edge of the mandelbrot set round to see a video of all the changing julia sets that are on the brink of being connected. Maybe the points rendered could be generated by the inverse function, which tends towards the edge of the set. The best of luck to you if you try something like this.

Make sure you post your results. I''d enjoy seeing them.
Well, I''ve got a new coloring scheme that I kind of like. Not great, but ok. I don''t have a utility for turning a bitmap into a jpeg or gif, though. Is there a small simple program that does that?
You know what I never noticed before?

This topic is closed to new replies.

Advertisement