示例#1
0
 /// <inheritdoc />
 protected override void OnInverse(double[] xy, double[] lp, int startIndex, int numPoints)
 {
     for (int i = startIndex; i < startIndex + numPoints; i++)
     {
         int    phi = i * 2 + PHI;
         int    lam = i * 2 + LAMBDA;
         int    x = i * 2 + X;
         int    y = i * 2 + Y;
         double us, vs;
         if (!_rot)
         {
             us = xy[x];
             vs = xy[y];
         }
         else
         {
             vs = xy[x] * _cosrot - xy[y] * _sinrot;
             us = xy[y] * _cosrot + xy[x] * _sinrot;
         }
         us += _u0;
         double q  = Math.Exp(-_bl * vs / _al);
         double s  = .5 * (q - 1 / q);
         double vl = Math.Sin(_bl * us / _al);
         double ul = 2 * (vl * _cosgam + s * _singam) / (q + 1 / q);
         if (Math.Abs(Math.Abs(ul) - 1) < EPS10)
         {
             lp[lam] = 0;
             lp[phi] = ul < 0 ? -HALF_PI : HALF_PI;
         }
         else
         {
             lp[phi] = _el / Math.Sqrt((1 + ul) / (1 - ul));
             if (_ellips)
             {
                 if ((lp[phi] = Proj.Phi2(Math.Pow(lp[phi], 1 / _bl), E)) == double.MaxValue)
                 {
                     lp[lam] = double.NaN;
                     lp[phi] = double.NaN;
                     continue;
                     //ProjectionException(20);
                 }
             }
             else
             {
                 lp[phi] = HALF_PI - 2 * Math.Atan(lp[phi]);
             }
             lp[lam] = -Math.Atan2((s * _cosgam - vl * _singam), Math.Cos(_bl * us / _al)) / _bl;
         }
     }
 }
示例#2
0
        /// <inheritdoc />
        protected override void OnInverse(double[] xy, double[] lp, int startIndex, int numPoints)
        {
            for (int i = startIndex; i < startIndex + numPoints; i++)
            {
                int    phi = i * 2 + PHI;
                int    lam = i * 2 + LAMBDA;
                int    x   = i * 2 + X;
                int    y   = i * 2 + Y;
                double cx  = xy[x] / K0;
                double cy  = _rho0 - xy[y] / K0;

                _rho = Math.Sqrt(cx * cx + cy * cy);

                if (_rho != 0.0)
                {
                    if (_n < 0)
                    {
                        _rho = -_rho;
                        cx   = -cx;
                        cy   = -cy;
                    }
                    if (_ellipse)
                    {
                        double temp = Math.Pow(_rho / _c, 1 / _n);
                        lp[phi] = Proj.Phi2(temp, E);
                        if (lp[phi] == double.MaxValue)
                        {
                            lp[lam] = double.NaN;
                            lp[phi] = double.NaN;
                            continue;
                            //throw new ProjectionException(20);
                        }
                    }
                    else
                    {
                        lp[phi] = 2 * Math.Atan(Math.Pow(_c / _rho, 1 / _n)) - HALF_PI;
                    }
                    lp[lam] = Math.Atan2(cx, cy) / _n;
                }
                else
                {
                    lp[lam] = 0;
                    lp[phi] = _n > 0 ? HALF_PI : -HALF_PI;
                }
            }
        }
 /// <inheritdoc />
 protected override void EllipticalInverse(double[] xy, double[] lp, int startIndex, int numPoints)
 {
     for (int i = startIndex; i < startIndex + numPoints; i++)
     {
         int phi = i * 2 + PHI;
         int lam = i * 2 + LAMBDA;
         int x   = i * 2 + X;
         int y   = i * 2 + Y;
         if ((lp[phi] = Proj.Phi2(Math.Exp(-xy[y] / K0), E)) == double.MaxValue)
         {
             lp[lam] = double.NaN;
             lp[phi] = double.NaN;
             continue;
             //throw new ProjectionException(20);
         }
         lp[lam] = xy[x] / K0;
     }
 }