void DrawJulia(float cx,float cy)
{
initgraph(640,480);
//setorigin(getwidth() / 2, getheight() / 2);
float zx,zy;
for (int i = -320;i<320;i++){
for (int j = -240;j<240;j++){
zx = i/320.0;
zy = j/240.0;
int k = 0;
for (k=0;k<100;k++){
if(sqrt((float)(zx*zx+zy*zy))>2){
putpixel(i+320,j+240,HSLtoRGB(200,k*6,200));
break;
}else{
float tx = zx,ty = zy;
zx = tx*tx - ty*ty+cx;
zy = 2*tx*ty+cy;
}
}
}
}
getch();
closegraph();
}
一下是DrawJulia(-0.19,0.6557);的结果,用到了easyx库。
Julia分形算法VC++实现
最新推荐文章于 2021-05-17 10:16:25 发布