0

私は一日中これに対して頭をぶつけてきました。これは本当にうまくいくはずだと思います!これを微調整するために何をしても、単一のドットが出力されます。どんな助けでも大歓迎です!

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);

        }


    }
}
4

1 に答える 1

0

2 つの問題があります。

1) 最大反復回数を 50 に設定しましたが、最大反復回数 40 を使用して黒を描画するかどうかを決定します。

2) 方程式の x 座標と y 座標を使用して描画しています。描画している x ピクセル座標と y ピクセル座標を別々に保持する必要があります。

于 2013-10-19T00:53:53.643 に答える