Example #1
0
        public override Coordinate ProjectInverse(double x, double y, Coordinate coord)
        {
            x /= ScaleFactor;
            y /= ScaleFactor;
            double rho = ProjectionMath.Distance(x, y = rho0 - y);

            if (rho != 0)
            {
                if (n < 0.0)
                {
                    rho = -rho;
                    x   = -x;
                    y   = -y;
                }
                if (Spherical)
                {
                    coord.Y = 2.0 * Math.Atan(Math.Pow(c / rho, 1.0 / n)) - ProjectionMath.PiHalf;
                }
                else
                {
                    coord.Y = ProjectionMath.Phi2(Math.Pow(rho / c, 1.0 / n), Eccentricity);
                }
                coord.X = Math.Atan2(x, y) / n;
            }
            else
            {
                coord.X = 0.0;
                coord.Y = n > 0.0 ? ProjectionMath.PiHalf : -ProjectionMath.PiHalf;
            }
            return(coord);
        }
Example #2
0
 public override Coordinate ProjectInverse(double x, double y, Coordinate coord)
 {
     if (_spherical)
     {
         coord.Y = ProjectionMath.PiHalf - 2.0 * Math.Atan(Math.Exp(-y / ScaleFactor));
         coord.X = x / ScaleFactor;
     }
     else
     {
         coord.Y = ProjectionMath.Phi2(Math.Exp(-y / ScaleFactor), _e);
         coord.X = x / ScaleFactor;
     }
     return(coord);
 }
        public override Coordinate ProjectInverse(double x, double y, Coordinate lp)
        {
            double q, s, ul, us, vl, vs;

            if (!rot)
            {
                us = x;
                vs = y;
            }
            else
            {
                vs = x * cosrot - y * sinrot;
                us = y * cosrot + x * sinrot;
            }
            us += u_0;
            q   = Math.Exp(-bl * vs / al);
            s   = .5 * (q - 1.0 / q);
            vl  = Math.Sin(bl * us / al);
            ul  = 2.0 * (vl * cosgam + s * singam) / (q + 1.0 / q);
            if (Math.Abs(Math.Abs(ul) - 1.0) < EPS10)
            {
                lp.X = 0.0;
                lp.Y = ul < 0.0 ? -ProjectionMath.PiHalf : ProjectionMath.PiHalf;
            }
            else
            {
                lp.Y = el / Math.Sqrt((1.0 + ul) / (1.0 - ul));
                if (!Spherical)
                {
                    lp.Y = ProjectionMath.Phi2(Math.Pow(lp.Y, 1.0 / bl), Eccentricity);
                }
                else
                {
                    lp.Y = ProjectionMath.PiHalf - 2.0 * Math.Atan(lp.Y);
                }
                lp.X = -Math.Atan2((s * cosgam -
                                    vl * singam), Math.Cos(bl * us / al)) / bl;
            }
            return(lp);
        }