Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/148.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Mandelbrot集合输出单个点_C++_Mandelbrot - Fatal编程技术网

C++ Mandelbrot集合输出单个点

C++ Mandelbrot集合输出单个点,c++,mandelbrot,C++,Mandelbrot,我一整天都在用头撞这个。我觉得这真的应该管用!不管我怎么做,它都会输出一个点。任何帮助都将不胜感激 double x_init, y_init; //These will be the real and imaginary aspects of C double x_temp, y_temp; //We gotta hold values while we update the new x, y since they are based recursively on previous va

我一整天都在用头撞这个。我觉得这真的应该管用!不管我怎么做,它都会输出一个点。任何帮助都将不胜感激

double x_init, y_init;  //These will be the real and imaginary aspects of C 
double x_temp, y_temp;  //We gotta hold values while we update the new x, y since they are based recursively on previous values;
double arg; // This will be our square root test



for (double y = - 1.6; y < 1.6; y += .002)
{
    for (double x = -1.5; x < 0.6; x += .004)
    {
        x_init = x;
        y_init = y;

        int iter = 0;
        arg = 0;
        while(iter < 50 && arg < 2)
        {
            x_temp = x;
            y_temp = y;
            x = (x_temp * x_temp) - (y_temp * y_temp) + x_init;
            y = 2 * x_temp * y_temp + y_init;
            arg = sqrt(x*x + y*y);
            iter++;
        }
        if (iter > 40)
        {
            drawBlack(x_init, y_init);

        }


    }
}
double x_init,y_init//这些将是C语言的真实和想象的方面
双x_温度,y_温度//我们必须在更新新的x,y时保持值,因为它们是基于以前的值递归的;
双参数;//这将是我们的平方根测试
对于(双y=-1.6;y<1.6;y+=.002)
{
对于(双x=-1.5;x<0.6;x+=.004)
{
x_init=x;
y_init=y;
int-iter=0;
arg=0;
而(iter<50&&arg<2)
{
x_temp=x;
y_temp=y;
x=(x_temp*x_temp)-(y_temp*y_temp)+x_init;
y=2*x_temp*y_temp+y_init;
arg=sqrt(x*x+y*y);
iter++;
}
如果(iter>40)
{
深黑色(x_初始,y_初始);
}
}
}
有两个问题:

1) 您已将“最大迭代次数”设置为50,但随后使用“最大迭代次数”40来确定是否绘制黑色

2) 你要用方程的x和y坐标来画。您需要在绘制时保持单独的x和y像素坐标

可能(未提供)
drawBlack
例程会缩放到屏幕。