Exemplo n.º 1
0
        public static int CubeRootPainter(Complex z0, FrameParams p)
        {
            Complex z = z0;

            for (int i = 0; i < 100; i++)
            {
                Complex z1 = (2.0 / 3.0) * z + 1 / (3 * z * z);


                if ((z - z1).Magnitude < 1e-9)
                {
                    break;
                }
                z = z1;
            }

            if (z.Imaginary < 1e-5 && z.Imaginary > -1e-5)
            {
                return(0);
            }
            if (z.Imaginary > 0)
            {
                return(1);
            }
            if (z.Imaginary < 0)
            {
                return(2);
            }
            return(0);
        }
Exemplo n.º 2
0
        public static int DebugPainter(Complex c, FrameParams p)
        {
            Complex z = c;

            for (int i = 0; i < 50; i++)
            {
                z = p.k[1] * z * z + p.k[2] * c * z + p.k[3] * c * c;
                if (z.Magnitude > 100)
                {
                    return(i);
                }
            }
            return(50);
        }
Exemplo n.º 3
0
        public static int MandelBrotTetraPainter(Complex c, FrameParams p)
        {
            Complex z = 0;

            for (int i = 0; i < 255; i++)
            {
                z = z * z * z * z + c;
                if (z.Real * z.Real + z.Imaginary * z.Imaginary > 16)
                {
                    return(i);
                }
            }
            return(255);
        }
Exemplo n.º 4
0
        //step=0.0 - the same
        //step=1.0 - totally new
        //linear
        public FrameParams getMove(FrameParams newParams, double step)
        {
            FrameParams ret = this.clone();

            ret.genFunc.move(newParams.genFunc, step);
            for (int i = 0; i < N; i++)
            {
                ret.k[i] = this.k[i] + (newParams.k[i] - this.k[i]) * step;
            }

            ret.genInfty = newParams.genInfty;
            ret.genSteps = newParams.genSteps;
            ret.genInit  = newParams.genInit;

            return(ret);
        }
Exemplo n.º 5
0
        public static int PolynomPainter2(Complex c, FrameParams p)
        {
            int M = p.maxUsedColors - 1;

            Complex z = 0;

            for (int i = 0; i < M; i++)
            {
                z = p.k[0] + p.k[1] * z + p.k[2] * c + p.k[3] * z * z + p.k[4] * z * c + p.k[5] * c * c;
                if (z.Real * z.Real + z.Imaginary * z.Imaginary > 1000)
                {
                    return(i);
                }
            }
            return(M);
        }
Exemplo n.º 6
0
        public static int GenericMandelbrotPainter(Complex c, FrameParams p)
        {
            int M = p.maxUsedColors - 1;

            Complex z = 0;

            for (int i = 0; i < M; i++)
            {
                z = Complex.Pow(z, p.k[0]) + c;
                if (z.Real * z.Real + z.Imaginary * z.Imaginary > 4)
                {
                    return(i);
                }
            }
            return(M);
        }
Exemplo n.º 7
0
        public FrameParams clone()
        {
            FrameParams ret = new FrameParams(this.N, this.maxUsedColors);

            for (int i = 0; i < N; i++)
            {
                ret.k[i] = this.k[i];
            }

            if (this.genFunc != null)
            {
                ret.genFunc = this.genFunc.clone();
            }
            ret.genInfty = this.genInfty;
            ret.genInit  = this.genInit;
            ret.genSteps = this.genSteps;

            return(ret);
        }
Exemplo n.º 8
0
        public static int MandelbrotPainter(Complex c, FrameParams p)
        {
            //Check Cardioid
            double r = Math.Sqrt((c.Real - 0.25) * (c.Real - 0.25) + c.Imaginary * c.Imaginary);
            double t = Math.Atan2(c.Imaginary, c.Real);

            if (r <= 0.5 * (1 - Math.Cos(t)))
            {
                return(0);
            }

            Complex z = 0;

            for (int i = 0; i < 200; i++)
            {
                z = z * z + c;
                if (z.Real * z.Real + z.Imaginary * z.Imaginary > 4)
                {
                    return(1);
                }
            }
            return(0);
        }
Exemplo n.º 9
0
        public static int TetraRootPainter(Complex z0, FrameParams p)
        {
            Complex z = z0;

            for (int i = 0; i < 100; i++)
            {
                Complex z1 = 0.75 * z + 0.25 / (z * z * z);
                //Complex z1 = z -( Complex.Pow(z, _k1)-1) / ((_k1 - 1) * Complex.Pow(z, _k1 - 1));

                if ((z - z1).Magnitude < 1e-9)
                {
                    break;
                }
                z = z1;
            }

            if (z.Imaginary < 1e-5 && z.Imaginary > -1e-5)
            {
                if (z.Real > 0)
                {
                    return(0);
                }
                if (z.Real < 0)
                {
                    return(1);
                }
            }
            if (z.Imaginary > 0)
            {
                return(2);
            }
            if (z.Imaginary < 0)
            {
                return(3);
            }
            return(0);
        }
Exemplo n.º 10
0
 public static int DzetaPainter(Complex c, FrameParams p)
 {
     return(0);
 }