Beispiel #1
0
        /// <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;
                double s;

                if ((s = Math.Abs(lp[phi] = Proj.InvMlfn(xy[y], Es, _en))) < HALF_PI)
                {
                    s       = Math.Sin(lp[phi]);
                    lp[lam] = xy[x] * Math.Sqrt(1 - Es * s * s) / Math.Cos(lp[phi]);
                }
                else if ((s - EPS10) < HALF_PI)
                {
                    lp[lam] = 0;
                }
                else
                {
                    lp[lam] = double.NaN;
                    lp[phi] = double.NaN;
                    continue;
                    //ProjectionException(20);
                }
            }
        }
Beispiel #2
0
        /// <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;
                double s;

                double rh = Proj.Hypot(xy[x], xy[y] = _am1 - xy[y]);
                lp[phi] = Proj.InvMlfn(_am1 + _m1 - rh, Es, _en);
                if ((s = Math.Abs(lp[phi])) < HALF_PI)
                {
                    s       = Math.Sin(lp[phi]);
                    lp[lam] = rh * Math.Atan2(xy[x], xy[y]) *
                              Math.Sqrt(1 - Es * s * s) / Math.Cos(lp[phi]);
                }
                else if (Math.Abs(s - HALF_PI) <= EPS10)
                {
                    lp[lam] = 0;
                }
                else
                {
                    lp[lam] = double.NaN;
                    lp[phi] = double.NaN;
                    continue;
                    //throw new ProjectionException(20);
                }
            }
        }
Beispiel #3
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;
         if ((_rho = Proj.Hypot(xy[x], xy[y] = _rho0 - xy[y])) != 0.0)
         {
             if (_n < 0)
             {
                 _rho  = -_rho;
                 xy[x] = -xy[x];
                 xy[y] = -xy[y];
             }
             lp[phi] = _c - _rho;
             if (IsElliptical)
             {
                 lp[phi] = Proj.InvMlfn(lp[phi], Es, _en);
             }
             lp[lam] = Math.Atan2(xy[x], xy[y]) / _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)
        {
            if (_isGuam)
            {
                GuamInverse(xy, lp, startIndex, 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 c;

                if ((c = Proj.Hypot(xy[x], xy[y])) < EPS10)
                {
                    lp[phi] = Phi0;
                    lp[lam] = 0;
                    continue;
                }
                if (_mode == Modes.Oblique || _mode == Modes.Equitorial)
                {
                    double az;
                    double cosAz = Math.Cos(az = Math.Atan2(xy[x], xy[y]));
                    double t     = _cosph0 * cosAz;
                    double b     = Es * t / OneEs;
                    double a     = -b * t;
                    b *= 3 * (1 - a) * _sinph0;
                    double d   = c / _n1;
                    double e   = d * (1 - d * d * (a * (1 + a) / 6 + b * (1 + 3 * a) * d / 24));
                    double f   = 1 - e * e * (a / 2 + b * e / 6);
                    double psi = Proj.Aasin(_sinph0 * Math.Cos(e) + t * Math.Sin(e));
                    lp[lam] = Proj.Aasin(Math.Sin(az) * Math.Sin(e) / Math.Cos(psi));
                    if ((t = Math.Abs(psi)) < EPS10)
                    {
                        lp[phi] = 0;
                    }
                    else if (Math.Abs(t - HALF_PI) < 0)
                    {
                        lp[phi] = HALF_PI;
                    }
                    else
                    {
                        lp[phi] = Math.Atan((1 - Es * f * _sinph0 / Math.Sin(psi)) * Math.Tan(psi) /
                                            OneEs);
                    }
                }
                else
                {
                    /* Polar */
                    lp[phi] = Proj.InvMlfn(_mode == Modes.NorthPole ? _mp - c : _mp + c,
                                           Es, _en);
                    lp[lam] = Math.Atan2(xy[x], _mode == Modes.NorthPole ? -xy[y] : xy[y]);
                }
            }
        }
        private void GuamInverse(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 t   = 0;
                int    j;

                double x2 = 0.5 * xy[x] * xy[x];
                lp[phi] = Phi0;
                for (j = 0; j < 3; ++j)
                {
                    t       = E * Math.Sin(lp[phi]);
                    lp[phi] = Proj.InvMlfn(_m1 + xy[y] -
                                           x2 * Math.Tan(lp[phi]) * (t = Math.Sqrt(1 - t * t)), Es, _en);
                }
                lp[lam] = xy[x] * t / Math.Cos(lp[phi]);
            }
        }
Beispiel #6
0
 /// <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;
         double ph1 = Proj.InvMlfn(_m0 + xy[y], Es, _en);
         _tn     = Math.Tan(ph1);
         _t      = _tn * _tn;
         _n      = Math.Sin(ph1);
         _r      = 1 / (1 - Es * _n * _n);
         _n      = Math.Sqrt(_r);
         _r     *= (1 - Es) * _n;
         _dd     = xy[x] / _n;
         _d2     = _dd * _dd;
         lp[phi] = ph1 - (_n * _tn / _r) * _d2 *
                   (.5 - (1 + 3 * _t) * _d2 * C3);
         lp[lam] = _dd * (1 + _t * _d2 *
                          (-C4 + (1 + 3 * _t) * _d2 * C5)) / Math.Cos(ph1);
     }
 }