Пример #1
0
        public static LBCoord reversLambert(ellipsoid ellip, XYCoord _xyc, double _log1, double _log2, double _log0,
                                            double _lat0, ref string result)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);

            double e = _ellip.e1;

            result += "e:" + e.ToString() + " a:" + _ellip.a.ToString() + "\n";
            result += "-------------------------------------\n";

            double log1 = _log1 * Math.PI / 180.0;
            double log2 = _log2 * Math.PI / 180.0;

            double log0 = _log0 * Math.PI / 180.0;
            double lat0 = _lat0 * Math.PI / 180.0;

            double E = _xyc.X;
            double N = _xyc.Y;


            result += "l1:" + log1.ToString() + "\n";

            result += "l2:" + log2.ToString() + "\n";
            result += "log0:" + log0.ToString() + "\n";
            result += "lat0:" + lat0.ToString() + "\n";
            result += "E:" + E.ToString() + "\n";
            result += "N:" + N.ToString() + "\n";
            result += "-----------------------\n";

            double m1 = Math.Cos(log1) / Math.Sqrt(1 - e * e * Math.Sin(log1) * Math.Sin(log1));
            double m2 = Math.Cos(log2) / Math.Sqrt(1 - e * e * Math.Sin(log2) * Math.Sin(log2));

            result += "m1:" + m1.ToString() + "\n";
            result += "m1:" + m2.ToString() + "\n";

            double t1 = Lam_gett(log1, e);
            double t2 = Lam_gett(log2, e);
            double tF = Lam_gett(log0, e);


            result += "t1:" + t1.ToString() + "\n";
            result += "t2:" + t2.ToString() + "\n";
            result += "tF:" + tF.ToString() + "\n";


            double n  = Math.Log(m1 / m2, Math.E) / Math.Log(t1 / t2, Math.E);
            double F  = m1 / (n * Math.Pow(t1, n));
            double rF = _ellip.a * (F * Math.Pow(tF, n));


            result += "n:" + n.ToString() + "\n";
            result += "F:" + F.ToString() + "\n";
            result += "rF:" + rF.ToString() + "\n";


            double EF  = 0;
            double NF  = 0.0;
            double tht = Math.Atan((E - EF) / (rF - (N - NF)));
            double r   = Math.Sqrt((E - EF) * (E - EF) + (rF - (N - NF)) * (rF - (N - NF)));

            if (n < 0)
            {
                r = -r;
            }
            double t = Math.Pow(r / (_ellip.a * F), 1 / n);

            result += "tht:" + tht.ToString() + "\n";
            result += "r:" + r.ToString() + "\n";
            result += "t:" + t.ToString() + "\n";

            double log    = Math.PI / 2 - 2 * Math.Atan(t);
            double prelog = log + 1;

            while (log != prelog)
            {
                prelog = log;
                log    = Math.PI / 2 - 2 * Math.Atan(t * Math.Pow((1 - e * Math.Sin(log)) / (1 + e * Math.Sin(log)), e / 2));
            }
            double lat = tht / n + lat0;

            return(new LBCoord(lat / Math.PI * 180, log / Math.PI * 180));
        }
Пример #2
0
        public static LBCoord reVersAlbers(ellipsoid ellip, XYCoord _xyc, double _log1, double _log2, double _log0,
                                           double _lat0, ref string result)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);

            double e = _ellip.e1;

            result += "e:" + e.ToString() + " a:" + _ellip.a.ToString() + "\n";
            result += "-------------------------------------\n";

            double l1 = _log1 * Math.PI / 180.0;
            double l2 = _log2 * Math.PI / 180.0;

            double l0   = _log0 * Math.PI / 180.0;
            double lmt0 = _lat0 * Math.PI / 180.0;

            double E = _xyc.X;
            double N = _xyc.Y;


            result += "l1:" + l1.ToString() + "\n";

            result += "l2:" + l2.ToString() + "\n";
            result += "l0:" + l0.ToString() + "\n";
            result += "lmt0:" + lmt0.ToString() + "\n";
            result += "E:" + E.ToString() + "\n";
            result += "N:" + N.ToString() + "\n";
            result += "-----------------------\n";


            double alpha1 = getalpha(_ellip, l1);
            double alpha2 = getalpha(_ellip, l2);
            double alpha0 = getalpha(_ellip, l0);


            double m1 = Math.Cos(l1) / Math.Sqrt(1 - e * e * Math.Sin(l1) * Math.Sin(l1));
            double m2 = Math.Cos(l2) / Math.Sqrt(1 - e * e * Math.Sin(l2) * Math.Sin(l2));


            result += "m1:" + m1.ToString() + "\nm2:" + m2.ToString() + "\n";
            double n = (m1 * m1 - m2 * m2) / (alpha2 - alpha1);
            double c = (m1 * m1 * alpha2 - m2 * m2 * alpha1) / (alpha2 - alpha1);

            result += "n:" + n.ToString() + "\nc:" + c.ToString() + "\n";

            double rol0  = (_ellip.a * Math.Sqrt(c - n * alpha0)) / n;
            double tht   = Math.Atan(E / (rol0 - N));
            double rol   = Math.Sqrt(E * E + (rol0 - N) * (rol0 - N));
            double alpha = (c - rol * rol * n * n / (_ellip.a * _ellip.a)) / n;

            //λO + (θ / n) ?' + (e2/3 + 31e4/180 + 517e6/5040) . sin 2?'] + [(23e4/360 + 251e6/3780) . sin 4?']
            //+ [(761e6/45360) . sin 6?']
            result += "rol0:" + rol0.ToString() + "\nrol:" + rol.ToString() + "\n";
            double beta = Math.Asin(alpha / (1 - (1 - e * e) / (2 * e) * Math.Log((1 - e) / (1 + e), Math.E)));

            double lmt = (lmt0 + (tht / n)) / Math.PI * 180.0;

            double l = beta + (e * e / 3 + 31 * Math.Pow(e, 4) / 180 + 517 * Math.Pow(e, 6) / 5040) * Math.Sin(2 * beta) +
                       (23 * Math.Pow(e, 4) / 360
                        + 251 * Math.Pow(e, 6) / 3780) * Math.Sin(4 * beta) + 761 * Math.Pow(e, 6) / 45360 * Math.Sin(6 * beta);

            return(new LBCoord(lmt, (l / Math.PI * 180.0)));
        }
Пример #3
0
        public static XYCoord lambert(ellipsoid ellip, LBCoord _lbc, double _log1, double _log2, double _log0,
                                      double _lat0, ref string result)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);
            double    e      = _ellip.e1;

            //result+="ellipsoid.Clarke1866\n";

            result += "e:" + e.ToString() + " a:" + _ellip.a.ToString() + "\n";
            result += "-------------------------------------\n";
            double log1 = _log1 * Math.PI / 180.0;
            double log2 = _log2 * Math.PI / 180.0;

            result += "log1:" + log1.ToString() + "\n";
            result += "log1:" + log2.ToString() + "\n";


            double log0 = _log0 * Math.PI / 180.0;
            double lat0 = _lat0 * Math.PI / 180.0;

            result += "log0:" + log0.ToString() + "\n";
            result += "lat0:" + lat0.ToString() + "\n";

            double log = _lbc.lon * Math.PI / 180.0;
            double lat = _lbc.lat * Math.PI / 180.0;

            result += "log:" + log.ToString() + "\n";
            result += "lat:" + lat.ToString() + "\n";


            //double jiao=Math.Asin(e*Math.Sin(l));

            result += "-------------------------------------\n";

            double m1 = Math.Cos(log1) / Math.Sqrt(1 - e * e * Math.Sin(log1) * Math.Sin(log1));
            double m2 = Math.Cos(log2) / Math.Sqrt(1 - e * e * Math.Sin(log2) * Math.Sin(log2));

            result += "m1:" + m1.ToString() + "\n";
            result += "m1:" + m2.ToString() + "\n";

            double t1 = Lam_gett(log1, e);
            double t2 = Lam_gett(log2, e);
            double tF = Lam_gett(log0, e);
            double t  = Lam_gett(log, e);

            result += "t1:" + t1.ToString() + "\n";
            result += "t2:" + t2.ToString() + "\n";
            result += "tF:" + tF.ToString() + "\n";
            result += "t:" + t.ToString() + "\n";

            double n = Math.Log(m1 / m2, Math.E) / Math.Log(t1 / t2, Math.E);

            double F = m1 / (n * Math.Pow(t1, n));

            double r  = _ellip.a * F * Math.Pow(t, n);
            double rF = _ellip.a * (F * Math.Pow(tF, n));


            double tht = n * (lat - lat0);

            result += "a:" + _ellip.a.ToString() + "\n";
            result += "n:" + n.ToString() + "\n";
            result += "F:" + F.ToString() + "\n";
            result += "r:" + r.ToString() + "\n";
            result += "rF:" + rF.ToString() + "\n";
            result += "tht:" + tht.ToString() + "\n";

            return(new XYCoord(r * Math.Sin(tht), rF - r * Math.Cos(tht)));
        }
Пример #4
0
        public static XYCoord albers(ellipsoid ellip, LBCoord _lbc, double _log1, double _log2, double _log0,
                                     double _lat0, ref string result)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);

            double e = _ellip.e1;

            result += "e:" + e.ToString() + " a:" + _ellip.a.ToString() + "\n";
            result += "-------------------------------------\n";

            double l1 = _log1 * Math.PI / 180.0;
            double l2 = _log2 * Math.PI / 180.0;

            double l0   = _log0 * Math.PI / 180.0;
            double lmt0 = _lat0 * Math.PI / 180.0;

            double l   = _lbc.lon * Math.PI / 180.0;
            double lmt = _lbc.lat * Math.PI / 180.0;


            result += "l1:" + l1.ToString() + "\n";

            result += "l2:" + l2.ToString() + "\n";
            result += "l0:" + l0.ToString() + "\n";
            result += "lmt0:" + lmt0.ToString() + "\n";
            result += "l:" + l.ToString() + "\n";
            result += "lmt:" + lmt.ToString() + "\n";
            result += "-----------------------\n";


            double alpha0 = getalpha(_ellip, l0);
            double alpha1 = getalpha(_ellip, l1);
            double alpha2 = getalpha(_ellip, l2);

            double alpha = getalpha(_ellip, l);

            result += "alpha0:" + alpha0.ToString() + "\n";
            result += "alpha1:" + alpha1.ToString() + "\n";
            result += "alpha2:" + alpha2.ToString() + "\n";
            result += "alpha:" + alpha.ToString() + "\n";


            double m1 = Math.Cos(l1) / Math.Pow(1 - e * e * Math.Sin(l1) * Math.Sin(l1), 0.5);
            double m2 = Math.Cos(l2) / Math.Pow(1 - e * e * Math.Sin(l2) * Math.Sin(l2), 0.5);

            result += "m1:" + m1.ToString() + "\n";
            result += "m2:" + m2.ToString() + "\n";

            double n = (m1 * m1 - m2 * m2) / (alpha2 - alpha1);
            //double c=_ellip.a*_ellip.a*(m1*m1+n*alpha1);
            double c = (m1 * m1 * alpha2 - m2 * m2 * alpha1) / (alpha2 - alpha1);

            result += "n:" + n.ToString() + "\n";
            result += "c:" + c.ToString() + "\n";

            double tht  = n * (lmt - lmt0);
            double rol  = (_ellip.a * Math.Sqrt(c - n * alpha)) / n;
            double rol0 = (_ellip.a * Math.Sqrt(c - n * alpha0)) / n;

            result += "tht:" + tht.ToString() + "\n";
            result += "rol:" + rol.ToString() + "\n";
            result += "rol0:" + rol0.ToString() + "\n";

            double  E = rol * Math.Sin(tht);
            double  N = rol0 - (rol * Math.Cos(tht));
            XYCoord xyc;

            xyc.X = E;
            xyc.Y = N;

            return(xyc);
        }