Ejemplo n.º 1
0
        /// <summary>
        /// 计算A,B,C等参数
        /// </summary>
        /// <param name="sinA0">sinA0</param>
        /// <param name="ABC">ABC数组</param>
        /// <param name="alpha">alpha</param>
        /// <param name="beta">beta</param>
        private void CalABC_AlphaBeta(double sinA0, double[] ABC, ref double alpha, ref double beta, ref double gama)
        {
            double cos2_A0 = 1 - sinA0 * sinA0;
            double k_2 = 0;
            double e2 = Ell.e2, b = Ell.b;
            double e1 = Ell.e1;

            k_2 = GeoPro.Getk_2(e2, cos2_A0);
            GeoPro.GetABC(b, k_2, ABC);
            alpha = GeoPro.GetAlpha(e1, cos2_A0);
            beta  = GeoPro.GetBeta(e1, cos2_A0);
            gama  = GeoPro.GetGama(e1, cos2_A0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 单组数据反算
        /// </summary>
        /// <param name="geodesic">单组大地线数据</param>
        public void InverseSolution(GeodesicInfo geodesic)
        {
            //数据格式转换
            double B1 = GeoPro.DMS2RAD(geodesic.P1.B);
            double L1 = GeoPro.DMS2RAD(geodesic.P1.L);
            double B2 = GeoPro.DMS2RAD(geodesic.P2.B);
            double L2 = GeoPro.DMS2RAD(geodesic.P2.L);
            double A12 = 0, A21 = 0, S = 0;
            //椭球参数
            double e1, e2, b, c, a;

            e1 = Ell.e1; e2 = Ell.e2;
            b  = Ell.b; c = Ell.c; a = Ell.a;
            //辅助计算

            double u1 = Math.Atan(Math.Sqrt(1 - e1 * e1) * Math.Tan(B1));
            double u2 = Math.Atan(Math.Sqrt(1 - e1 * e1) * Math.Tan(B2));
            double dL = L2 - L1;

            double[] ab = CalPara(u1, u2);
            if (u1 == 0 && u2 == 0)
            {
                if (dL > 0)
                {
                    S   = a * dL;
                    A12 = Math.PI / 2;
                    A21 = Math.PI * 3 / 2;
                }
                else
                {
                    S   = a * dL;
                    A21 = Math.PI / 2;
                    A12 = Math.PI * 3 / 2;
                }
            }
            else
            {
                //逐次趋近法同时计算起点大地方位角,球面长度及经度差lamda
                double del     = 0;
                double lamda   = 0;
                double cos2_A0 = 0;

                CalA1_Lamda(dL, u2, u1, ab, ref lamda, ref A12, ref del, ref cos2_A0);

                //计算S
                double[] ABC = new double[3];
                double   k_2 = GeoPro.Getk_2(e2, cos2_A0);
                GeoPro.GetABC(b, k_2, ABC);

                double del1 = Math.Atan(Math.Tan(u1) / Math.Cos(A12));
                double xs12 = ABC[2] * Math.Sin(2 * del) * Math.Cos(4 * del1 + 2 * del);

                S = (del - ABC[1] * Math.Sin(del) * Math.Cos(2 * del1 + del) - xs12) / ABC[0];
                //计算A2
                A21 = Math.Atan(Math.Cos(u1) * Math.Sin(lamda) / (ab[2] * Math.Cos(lamda) - ab[3]));
                A21 = GeoPro.InvJudgeA1A2(Math.Cos(u1) * Math.Sin(lamda), (ab[2] * Math.Cos(lamda) - ab[3]), A21);
                //
                if (A12 >= Math.PI)
                {
                    A21 = A21 - Math.PI;
                }
                if (A12 < Math.PI)
                {
                    A21 = A21 + Math.PI;
                }
            }

            //
            geodesic.A12 = GeoPro.RAD2DMS(A12);
            geodesic.A21 = GeoPro.RAD2DMS(A21);
            geodesic.S   = S;
        }