[图形学] 5行C代码实现的分形图案 - Mandelbrot Set

     这是一段很有意思的C程序。

     只用5行核心代码,绘制一个曼德博集合(Mandelbrot Set)。

     This is the computer graphics. Let's enjoy the beauty of Fractal and math.

      

#include <stdio.h>

int main()
{
    int k=0;
    float i,j,r,x,y=-16;
    while(puts(""),y++<15)
        for(x=0; x++<84; putchar(" +++++++++++++++"[k&15]))
            for(i=k=r=0;j=r*r-i*i-2+x/25,i=2*r*i+y/10,j*j+i*i<11&&k++<111; r=j);

    getchar();
    return 0;
}

猜你喜欢

转载自blog.csdn.net/Mahabharata_/article/details/76375391