#include <complex.h>
#include <tgmath.h>
#include <winbgim.h>
#define Y 1080
#define X 1920
int
Mandle(
double
_Complex c,
double
_Complex t = 0,
int
counter = 0)
{
if
(cabs(t) > 4) {
putpixel(creal(c) * Y / 2 + X / 2,
cimag(c) * Y / 2 + Y / 2,
COLOR(128 - 128 * cabs(t) / cabs(c),
128 - 128 * cabs(t) / cabs(c),
128 - 128 * cabs(t) / cabs(c)));
return
0;
}
if
(counter == 100) {
putpixel(creal((c)) * Y / 2 + X / 2,
cimag((c)) * Y / 2 + Y / 2,
COLOR(255 * (cabs((t * t))
/ cabs((t - c) * c)),
0, 0));
return
0;
}
Mandle(c, cpow(t, 2) + c, counter + 1);
return
0;
}
int
MandleSet()
{
for
(
double
x = -2; x < 2; x += 0.0015) {
for
(
double
y = -1; y < 1; y += 0.0015) {
double
_Complex temp = x + y * _Complex_I;
Mandle(temp);
}
}
return
0;
}
int
main()
{
initwindow(X, Y);
MandleSet();
getch();
closegraph();
return
0;
}