Mandelbrot set in C++ and SDL




Most important parts of this programs are based on code of program mandel by Wolf Jung.
Thx for publishing the code under GNU General Public License
IDE = Dev-C++ v 4.9.9.2
OS - Windows
type - console program
graphic library : SDL .



cpp+Dev c++ + SDL - LSM

if (last_iter==iter_max) {color=(0 << 16) | (0 << 8) | 0; } // black interior
else color= 13000+last_iter*1000000; // exterior : Level Sets of escpe time
-------------------------------------------

if (last_iter==iter_max) {color=(0 << 16) | (0 << 8) | 0;} // black interior
else color=GiveColor32x(last_iter,iter_max); // exterior : Level Sets of escpe time with gray gradient

// gives gray gradient
Uint32 GiveColor32x(Sint32 ix, Sint32 ixmax)
{
Uint8 ired, iblue, igreen;
//compute color
ired = (ix * 255) / (ixmax - 1); // red
igreen = (ix * 255) / (ixmax - 1); // green
iblue = (ix * 255) / (ixmax - 1); // blue
return (ired << 16) | (igreen << 8) | iblue;

}

DEM



// compute escape time
int last_iter= EscapeTimeFast(C,iter_max,bailout2);
//compute color
if (last_iter==iter_max) {color=(0 << 16) | (0 << 8) | 0;} // interior - black
else {
double distance = Give_mdist( C, iter_max);
if (distance < pixel_size) color= (255 << 16) | (0 << 8) | 0; // boundary - red
else color= (255 << 16) | (255 << 8) | 255; // exterior - white

};

// compute escape time
int last_iter= EscapeTimeFast(C,iter_max,bailout2);
//compute color
if (last_iter==iter_max) {color=(0 << 16) | (0 << 8) | 0;} // interior - black
else {
double distance = Give_mdist( C, iter_max);
if (distance < pixel_size) color= (255 << 16) | (255 << 8) | 255; // boundary - white
else color= GiveRainbowColor(distance/distanceMax); // exterior - gradient

};


Here we modify cololors of exterior :
else color= GiveRainbowColor(abs(log(distance*1000)/distanceMax)); // exterior


else color= GiveRainbowColor(abs(log(distance*100000)/distanceMax)); // exterior


else color= GiveRainbowColor(abs(log(distance*10000000)/distanceMax)); // exterior




CPP + Dev C++ + SDL and DEM - zipped code


ArgPhi



Main page


Autor: Adam Majewski adammaj1-at-o2-dot-pl
Feel free to e-mail me. (:-))

Made with: EditPlus www.editplus.com



About

republika.pl/fraktal