Esempio n. 1
0
        /// <summary>
        /// X¾ØÕóÈçÏÂËùʾ
        ///
        ///
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <returns></returns>
        public double CalculateTrans7Param(double[,] X, double[,] Y)
        {
            int PtNum = X.GetLength(0) / 3;

            double[,] B;
            double[,] F;
            double[,] BT  = MatrixTool.Init(7, 3 * PtNum);
            double[,] BTB = MatrixTool.Init(7, 7);
            double[,] BTF = MatrixTool.Init(7, 1);


            //init pararm
            CoordTrans7Param dpp = new CoordTrans7Param();

            Set4Param(0, 0, 0, 0);
            this.SetRotationParamMM(0, 0, 0);
            //debug
            //this.TransCoord(X[0,0],X[1,0],X[2,0],out x2,out y2,out z2);
            int round = 0;

            while (round++ < 20)
            {
                F = GetF(X, Y);
                B = GetB(X);
                MatrixTool.AT(B, ref BT);

                MatrixTool.Multi(BT, B, ref BTB);
                MatrixTool.Inv(BTB);
                MatrixTool.Multi(BT, F, ref BTF);
                MatrixTool.Multi(BTB, BTF, ref dpp.values);
                if (dpp.isSmall())
                {
                    break;
                }
                else
                {
                    MatrixTool.Add(this.values, dpp.values, ref this.values);
                }
            }
            //this.TransCoord(X[0,0],X[1,0],X[2,0],out x2,out y2,out z2);
            double[,] V = GetV(X, Y, dpp);

            double vMax = -1;

            for (int i = 0; i < V.GetLength(0); i++)
            {
                if (Math.Abs(V[i, 0]) > vMax)
                {
                    vMax = Math.Abs(V[i, 0]);
                }
            }

            return(vMax);
        }
Esempio n. 2
0
        public void TransCoord(double x1, double y1, double z1, out double x2, out double y2, out double z2)
        {
            double[,] Xi = { { x1 }, { y1 }, { z1 } };
            double[,] DX = { { dx }, { dy }, { dz } };
            double[,] tY = new double[3, 1];
            double[,] K  = { { 1 + k } };

            double[,] M = GetM();
            MatrixTool.Multi(Xi, K, ref tY);
            MatrixTool.Multi(M, tY, ref tY);
            MatrixTool.Add(tY, DX, ref tY);
            x2 = tY[0, 0];
            y2 = tY[1, 0];
            z2 = tY[2, 0];
        }