示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("hello world");

        AlgPoly algPoly = new AlgPoly(10);

        algPoly.p[0]  = new Complex(0.04455f, -0.07194f);
        algPoly.p[1]  = new Complex(-0.05742f, 0.08978f);
        algPoly.p[2]  = new Complex(0.17168f, -0.28283f);
        algPoly.p[3]  = new Complex(-0.12969f, 0.08158f);
        algPoly.p[4]  = new Complex(-0.33418f, 0.26873f);
        algPoly.p[5]  = new Complex(0.14186f, 0.00000f);
        algPoly.p[6]  = new Complex(-0.33418f, -0.26873f);
        algPoly.p[7]  = new Complex(-0.12969f, -0.08158f);
        algPoly.p[8]  = new Complex(0.17168f, 0.28283f);
        algPoly.p[9]  = new Complex(-0.05742f, -0.08978f);
        algPoly.p[10] = new Complex(0.04455f, 0.07194f);

        Complex[] roots = algPoly.AberthEhrlich();

        //for (int k = 0; k < algPoly.N; k++)
        //{
        //    Debug.Log(roots[k].ToString() + "; abs: " + roots[k].Abs);
        //}

        //Complex val = algPoly.Eval(new Complex(4, 2));
        //Debug.Log(val.ToString());
    }
示例#2
0
            //public void ResetTransform()
            //{
            //    transform.Translation = Vector2.zero;
            //    transform.Orientation = Complex.identity;
            //}

            public AlgPoly Y2AlgPoly()
            {
                int     N       = LastInd;
                AlgPoly outPoly = new AlgPoly(2 * N);

                for (int k = -N; k < N + 1; k++)
                {
                    outPoly.p[k + N] = transform.rotation.y * x.c[k + N] + transform.rotation.x * y.c[k + N];
                }

                float X = transform.position.x + x.a[0];
                float Y = transform.position.y + y.a[0];

                outPoly.p[N] = new Complex(transform.rotation.y * X + transform.rotation.x * Y, 0f);

                return(outPoly);
            }