public override double Render()
        {
            double limit  = 4.0;
            double result = 0.0;

            for (double y = YB; y < YE; y += YS)
            {
                for (double x = YB; x < YE; x += XS)
                {
                    complex num   = new complex(x, y);
                    complex accum = num;
                    int     iters;
                    for (iters = 0; iters < 1000; iters++)
                    {
                        accum  = accum.square();
                        accum += num;
                        if (accum.sqabs() > limit)
                        {
                            break;
                        }
                    }
                    result += iters;
                }
            }
            return(result);
        }
Exemple #2
0
        public override double Render() {
            double limit = 4.0;
            double result = 0.0;

            for (double y = YB; y < YE; y += YS) {
                for (double x = YB; x < YE; x += XS) {
                    complex num = new complex(x, y);
                    complex accum = num;
                    int iters;
                    for (iters = 0; iters < 1000; iters++) {
                        accum = accum.square();
                        accum += num;
                        if (accum.sqabs() > limit)
                            break;
                    }
                    result += iters;
                }
            }
            return result;
        }
        public override double Render()
        {
            double limit  = 4.0;
            double result = 0.0;

            // set the Julia Set constant
            complex seed = new complex(Real, Imaginary);

            // run through every point on the screen, setting
            // m and n to the coordinates
            for (double m = XB; m < XE; m += XS)
            {
                for (double n = YB; n < YE; n += YS)
                {
                    // the initial z value is the current pixel,
                    // so x and y have to be set to m and n
                    complex accum = new complex(m, n);
                    // perform the iteration
                    int num;
                    for (num = 0; num < 1000; num++)
                    {
                        // exit the loop if the number  becomes too big
                        if (accum.sqabs() > limit)
                        {
                            break;
                        }
                        // use the formula
                        accum = accum.square() + seed;
                    }
                    // determine the color using the number of
                    // iterations it took for the number to become too big
                    // char color = num % number_of_colors;
                    // plot the point
                    result += num;
                }
            }
            return(result);
        }
Exemple #4
0
        public override double Render() {
            double limit = 4.0;
            double result = 0.0;

            // set the Julia Set constant
            complex seed = new complex(Real, Imaginary);
            // run through every point on the screen, setting 
            // m and n to the coordinates
            for (double m = XB; m < XE; m += XS) {
                for (double n = YB; n < YE; n += YS) {
                    // the initial z value is the current pixel,  
                    // so x and y have to be set to m and n
                    complex accum = new complex(m, n);
                    // perform the iteration
                    int num;
                    for (num = 0; num < 1000; num++) {
                        // exit the loop if the number  becomes too big
                        if (accum.sqabs() > limit)
                            break;
                        // use the formula
                        accum = accum.square() + seed;
                    }
                    // determine the color using the number of
                    // iterations it took for the number to become too big 
                    // char color = num % number_of_colors; 
                    // plot the point
                    result += num;
                }
            }
            return result;
        }