Example #1
0
        public void EvaluateOperations()
        {
            var complexOne       = new Complex(RealPartOne, ImgPartOne);
            var complexTwo       = new Complex(RealPartTwo, ImgPartTwo);
            var operationsResult = new OpsResult();

            operationsResult.Sum  = complexOne.add(complexTwo).ToString();
            operationsResult.Diff = complexOne.sub(complexTwo).ToString();
            operationsResult.Prod = complexOne.mul(complexTwo).ToString();
            operationsResult.Div  = complexOne.div(complexTwo).ToString();
            OperationsResult      = operationsResult;
            PolarOne = complexOne.ToPolarString();
            PolarTwo = complexTwo.ToPolarString();
        }
    //---------------------------------------------------------
    // 関数名 : getIODResult2
    // 機能   : 図形に対しての、全ての観測点における内部外部判定値を格納
    // 引数   : f_v/図形座標 m_v/観測点座標 flag/観測点の内部外部値
    // 戻り値 : flag/観測点の内部外部値
    //---------------------------------------------------------
    private int[,,] getIODResult2(ArrayList p_v, ArrayList m_v, int[,,] flag, int y)
    {
        for (int i = 0; i < m_v.Count; i++)
        {
            Complex com1 = new Complex(1, 0);
            Complex com = (Complex)m_v[i];
            Complex sum = new Complex(0, 0);   // コーシーの近似積分の値

            for (int j = 0; j < p_v.Count - 1; j++)
            {
                Complex c1 = (Complex)p_v[j];       //j番目の外部データ
                Complex c2 = (Complex)p_v[j + 1];   //j+1番目の外部データ
                Complex sub1 = c1.sub(com);
                Complex sub2 = c2.sub(c1);
                Complex div = com1.div(sub1);
                Complex mul = div.mul(sub2);
                sum = sum.add(mul);
            }

            double ch = Math.Sqrt(Math.Pow(sum.x, 2) + Math.Pow(sum.y, 2));


            if (flag[i % 32, (y - 5) / 10, i / 32] == 0)
            {
               if (ch > 5)
               {
                   flag[i % 32, (y - 5) / 10, i / 32] = 2;
                }
                else
                {
                    flag[i % 32, (y - 5) / 10, i / 32] = 1;
                }
            }
        }

        return flag;
    }