-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.c
46 lines (32 loc) · 890 Bytes
/
test1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <graphics.h>
#include <complex.h>
#include <math.h>
int main()
{ int gd = DETECT,gm=0;
initgraph(&gd,&gm,NULL);
complex Z,C,t,q;
int n = 4, iter = 20, i;
C = -1 + I* 0;
float ec = pow(2,1.0/(n-1));
float zx, zy, qx, qy, tx, ty;
for (zx=-1 * ec ; zx <= ec; zx += 0.01)
{
for (zy = -1 * ec; zy <= ec; zy += 0.01)
{ tx = zx ;
ty = zy;
t = tx + I*ty;
for (i=0; i<iter ; i++)
{
t = cpow(t,n) + C;
tx = creal(t);
ty = cimag(t);
if((tx*tx + ty*ty) > ec*ec)
break;
}
putpixel(200 + 100 * zx, 200 + 100* zy, i);
}
}
getch();
closegraph();
}