当前位置:首页 ›› 分形几何 ›› 分形几何 ›› 题目:Mandelbrot集C程序
【 注册 | 登陆 】
-
题目:Mandelbrot集C程序
- 作者:佚名
- 发表日期:十月 02, 2007
- 浏览:196次
-
收藏本文
- 编者导读:#include "graphics.h" #include "math.h" void MSB(cxmin,cxmax,cymin,cymax,nmax) float cxmin,cxmax,cymin,cymax; int nmax; { float sx=500.0,sy=400.0; float cx,cy,x,y,xx,yy,dx,dy,z,L=4.0; int i,j,n,color; dx=(cxmax-cxmin)/sx; dy=(cymax-cymin)/sy; for(i=0;i<sx;i++) { cx=cxmin+i*dx; for(j=0;j<sy;j++) { &nbs
#include "graphics.h"
#include "math.h"
void MSB(cxmin,cxmax,cymin,cymax,nmax)
float cxmin,cxmax,cymin,cymax;
int nmax;
{
float sx=500.0,sy=400.0;
float cx,cy,x,y,xx,yy,dx,dy,z,L=4.0;
int i,j,n,color;
dx=(cxmax-cxmin)/sx;
dy=(cymax-cymin)/sy;
for(i=0;i<sx;i++)
{
cx=cxmin+i*dx;
for(j=0;j<sy;j++)
{
cy=cymin+j*dy;
x=0;
y=0;
for(n=0;n<nmax;n++)
{
xx=x*x-y*y+cx;
yy=2*x*y+cy;
z=xx+yy;
if(fabs(z)>L)break;
x=xx;
y=yy;
}
color=n%16;
putpixel(i+50,j+40,color);
}
}
}
main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
MSB(-2.25,1.75,-1.8,1.5,100);
getch();
}
-
前一篇:题目:分形树C程序下一篇:题目:Julia集C程序
- 【引用地址】http://www.suanshu.net/list/5060.aspx
- 【关键字】题目:Mandelbrot集C程序
版权申明:非特殊申明,本站文章均系转载自互联网,如果侵犯了你的合法权益,请告知我们,我们会第一时间处理.
要点评这篇文章,请在下面留言
针对这篇文章的评论
- 不良评论请用报告管理员,以利管理员及时删除。
- 尊重网上道德,遵守中华人民共和国的各项有关法律法规。
- 承担一切因您的行为而直接或间接导致的民事或刑事法律责任。
- 本站评论管理人员有权保留或删除其管辖评论中的任意内容。
- 您在本站发表的作品,本站有权在网站内转载或引用。
- 参与本评论即表明您已经阅读并接受上述条款。