Esempio n. 1
0
        public override Coordinate Project(double lplam, double lpphi, Coordinate xy)
        {
            if (_spherical)
            {
                double cosphi = Math.Cos(lpphi);
                double b      = cosphi * Math.Sin(lplam);

                xy.X = _ml0 * _scaleFactor * Math.Log((1.0 + b) / (1.0 - b));
                double ty = cosphi * Math.Cos(lplam) / Math.Sqrt(1.0 - b * b);
                ty = ProjectionMath.Acos(ty);
                if (lpphi < 0.0)
                {
                    ty = -ty;
                }
                xy.Y = _esp * (ty - _projectionLatitude);
            }
            else
            {
                double al, als, n, t;
                double sinphi = Math.Sin(lpphi);
                double cosphi = Math.Cos(lpphi);
                t    = Math.Abs(cosphi) > 1e-10 ? sinphi / cosphi : 0.0;
                t   *= t;
                al   = cosphi * lplam;
                als  = al * al;
                al  /= Math.Sqrt(1.0 - _es * sinphi * sinphi);
                n    = _esp * cosphi * cosphi;
                xy.X = _scaleFactor * al * (FC1 +
                                            FC3 * als * (1.0 - t + n +
                                                         FC5 * als * (5.0 + t * (t - 18.0) + n * (14.0 - 58.0 * t)
                                                                      + FC7 * als * (61.0 + t * (t * (179.0 - t) - 479.0))
                                                                      )));
                xy.Y = _scaleFactor * (ProjectionMath.mlfn(lpphi, sinphi, cosphi, _en) - _ml0 +
                                       sinphi * al * lplam * FC2 * (1.0 +
                                                                    FC4 * als * (5.0 - t + n * (9.0 + 4.0 * n) +
                                                                                 FC6 * als * (61.0 + t * (t - 58.0) + n * (270.0 - 330 * t)
                                                                                              + FC8 * als * (1385.0 + t * (t * (543.0 - t) - 3111.0))
                                                                                              ))));
            }
            return(xy);
        }