public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { xyy /= C_y; lp.Y = ProjectionMath.Asin(Math.Sin(xyy) / n); lp.X = xyx / (C_x * Math.Cos(xyy)); return(lp); }
public override Coordinate Project(double lplam, double lpphi, Coordinate xy) { xy.Y = ProjectionMath.Asin(n * Math.Sin(lpphi)); xy.X = C_x * lplam * Math.Cos(lpphi); xy.Y = C_y * lpphi; return(xy); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { double V; int i; if (n != 0) { lp.Y = xyy; for (i = MaxIter; i > 0; --i) { lp.Y -= V = (n * lp.Y + n1 * Math.Sin(lp.Y) - xyy) / (n + n1 * Math.Cos(lp.Y)); if (Math.Abs(V) < LoopTolerance) { break; } } if (i == 0) { lp.Y = xyy < 0.0 ? -ProjectionMath.PiHalf : ProjectionMath.PiHalf; } } else { lp.Y = ProjectionMath.Asin(xyy); } V = Math.Cos(lp.Y); lp.X = xyx * (n + n1 * V) / V; return(lp); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { lp.Y = xyy / C_y; lp.X = xyx / (C_x * Math.Cos(lp.Y)); lp.Y = ProjectionMath.Asin(Math.Sin(lp.Y) / C_p1) / C_p2; return(lp); }
public override Coordinate Project(double lplam, double lpphi, Coordinate xy) { lpphi = ProjectionMath.Asin(0.883883476 * Math.Sin(lpphi)); xy.X = C_x * lplam * Math.Cos(lpphi); xy.X /= Math.Cos(lpphi *= 0.333333333333333); xy.Y = C_y * Math.Sin(lpphi); return(xy); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { double th, s; lp.X = 2.0 * xyx / (1.0 + Math.Cos(xyy)); lp.Y = ProjectionMath.Asin(0.5 * (xyy + Math.Sin(xyy))); return(lp); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { lp.Y = ProjectionMath.Asin(xyy / C_y); lp.X = xyx * Math.Cos(lp.Y) / C_x; lp.Y *= 3.0; lp.X /= Math.Cos(lp.Y); lp.Y = ProjectionMath.Asin(1.13137085 * Math.Sin(lp.Y)); return(lp); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { double c; lp.Y = ProjectionMath.Asin(xyy / C_y); lp.X = xyx / (C_x * (1.0 + (c = Math.Cos(lp.Y)))); lp.Y = ProjectionMath.Asin((lp.Y + Math.Sin(lp.Y) * (c + 2.0)) / C_p); return(lp); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { double t, s; lp.Y = C2 * (t = ProjectionMath.Asin(xyy / C_y)); lp.X = xyx / (C_x * (1.0 + 3.0 * Math.Cos(lp.Y) / Math.Cos(t))); lp.Y = ProjectionMath.Asin((C1 * Math.Sin(t) + Math.Sin(lp.Y)) / C3); return(lp); }
public override Coordinate ProjectInverse(double x, double y, Coordinate coord) { if (_spherical) { double h = Math.Exp(x / _scaleFactor); double g = 0.5 * (h - 1.0 / h); h = Math.Cos(_projectionLatitude + y / _scaleFactor); coord.Y = ProjectionMath.Asin(Math.Sqrt((1.0 - h * h) / (1.0 + g * g))); if (y < 0) { coord.Y = -coord.Y; } coord.X = Math.Atan2(g, h); } else { double n, con, cosphi, d, ds, sinphi, t; coord.Y = ProjectionMath.inv_mlfn(_ml0 + y / _scaleFactor, _es, _en); if (Math.Abs(y) >= ProjectionMath.PiHalf) { coord.Y = y < 0.0 ? -ProjectionMath.PiHalf : ProjectionMath.PiHalf; coord.X = 0.0; } else { sinphi = Math.Sin(coord.Y); cosphi = Math.Cos(coord.Y); t = Math.Abs(cosphi) > 1e-10 ? sinphi / cosphi : 0.0; n = _esp * cosphi * cosphi; d = x * Math.Sqrt(con = 1.0 - _es * sinphi * sinphi) / _scaleFactor; con *= t; t *= t; ds = d * d; coord.Y -= (con * ds / (1.0 - _es)) * FC2 * (1.0 - ds * FC4 * (5.0 + t * (3.0 - 9.0 * n) + n * (1.0 - 4 * n) - ds * FC6 * (61.0 + t * (90.0 - 252.0 * n + 45.0 * t) + 46.0 * n - ds * FC8 * (1385.0 + t * (3633.0 + t * (4095.0 + 1574.0 * t))) ))); coord.X = d * (FC1 - ds * FC3 * (1.0 + 2.0 * t + n - ds * FC5 * (5.0 + t * (28.0 + 24.0 * t + 8.0 * n) + 6.0 * n - ds * FC7 * (61.0 + t * (662.0 + t * (1320.0 + 720.0 * t))) ))) / cosphi; } } return(coord); }
public override Coordinate ProjectInverse(double xyx, double xyy, Coordinate lp) { double c; xyy /= _cY; c = Math.Cos(lp.Y = _tanMode ? Math.Atan(xyy) : ProjectionMath.Asin(xyy)); lp.Y /= _cP; lp.X = xyx / (_cX * Math.Cos(lp.Y /= _cP)); if (_tanMode) { lp.X /= c * c; } else { lp.X *= c; } return(lp); }
public override Coordinate Project(double lam, double phi, Coordinate xy) { if (Spherical) { double coslam, cosphi, sinphi; sinphi = Math.Sin(phi); cosphi = Math.Cos(phi); coslam = Math.Cos(lam); switch (Mode) { case AzimuthalMode.Equator: case AzimuthalMode.Oblique: if (Mode == AzimuthalMode.Equator) { xy.Y = cosphi * coslam; } else { xy.Y = _sinphi0 * sinphi + _cosphi0 * cosphi * coslam; } if (Math.Abs(Math.Abs(xy.Y) - 1.0) < Tolerance) { if (xy.Y < 0.0) { throw new ProjectionException(); } else { xy.X = xy.Y = 0.0; } } else { xy.Y = Math.Acos(xy.Y); xy.Y /= Math.Sin(xy.Y); xy.X = xy.Y * cosphi * Math.Sin(lam); xy.Y *= (Mode == AzimuthalMode.Equator) ? sinphi : _cosphi0 * sinphi - _sinphi0 * cosphi * coslam; } break; case AzimuthalMode.NorthPole: case AzimuthalMode.SouthPole: if (Mode == AzimuthalMode.NorthPole) { phi = -phi; coslam = -coslam; } if (Math.Abs(phi - ProjectionMath.PiHalf) < EPS10) { throw new ProjectionException(); } xy.X = (xy.Y = (ProjectionMath.PiHalf + phi)) * Math.Sin(lam); xy.Y *= coslam; break; } } else { double coslam, cosphi, sinphi, rho, s, H, H2, c, Az, t, ct, st, cA, sA; coslam = Math.Cos(lam); cosphi = Math.Cos(phi); sinphi = Math.Sin(phi); switch (Mode) { case AzimuthalMode.NorthPole: case AzimuthalMode.SouthPole: if (Mode == AzimuthalMode.NorthPole) { coslam = -coslam; } xy.X = (rho = Math.Abs(_mp - ProjectionMath.mlfn(phi, sinphi, cosphi, _en))) * Math.Sin(lam); xy.Y = rho * coslam; break; case AzimuthalMode.Equator: case AzimuthalMode.Oblique: if (Math.Abs(lam) < EPS10 && Math.Abs(phi - ProjectionLatitude) < EPS10) { xy.X = xy.Y = 0.0; break; } t = Math.Atan2(_oneEs * sinphi + EccentricitySquared * _n1 * _sinphi0 * Math.Sqrt(1.0 - EccentricitySquared * sinphi * sinphi), cosphi); ct = Math.Cos(t); st = Math.Sin(t); Az = Math.Atan2(Math.Sin(lam) * ct, _cosphi0 * st - _sinphi0 * coslam * ct); cA = Math.Cos(Az); sA = Math.Sin(Az); s = ProjectionMath.Asin(Math.Abs(sA) < Tolerance ? (_cosphi0 * st - _sinphi0 * coslam * ct) / cA : Math.Sin(lam) * ct / sA); H = _he * cA; H2 = H * H; c = _n1 * s * (1.0 + s * s * (-H2 * (1.0 - H2) / 6.0 + s * (_g * H * (1.0 - 2.0 * H2 * H2) / 8.0 + s * ((H2 * (4.0 - 7.0 * H2) - 3.0 * _g * _g * (1.0 - 7.0 * H2)) / 120.0 - s * _g * H / 48.0)))); xy.X = c * sA; xy.Y = c * cA; break; } } return(xy); }
public override Coordinate ProjectInverse(double x, double y, Coordinate lp) { if (Spherical) { double cosc, c_rh, sinc; if ((c_rh = ProjectionMath.Distance(x, y)) > Math.PI) { if (c_rh - EPS10 > Math.PI) { throw new ProjectionException(); } c_rh = Math.PI; } else if (c_rh < EPS10) { lp.Y = ProjectionLatitude; lp.X = 0.0; return(lp); } if (Mode == AzimuthalMode.Oblique || Mode == AzimuthalMode.Equator) { sinc = Math.Sin(c_rh); cosc = Math.Cos(c_rh); if (Mode == AzimuthalMode.Equator) { lp.Y = ProjectionMath.Asin(y * sinc / c_rh); x *= sinc; y = cosc * c_rh; } else { lp.Y = ProjectionMath.Asin(cosc * _sinphi0 + y * sinc * _cosphi0 / c_rh); y = (cosc - _sinphi0 * Math.Sin(lp.Y)) * c_rh; x *= sinc * _cosphi0; } lp.X = y == 0.0 ? 0.0 : Math.Atan2(x, y); } else if (Mode == AzimuthalMode.NorthPole) { lp.Y = ProjectionMath.PiHalf - c_rh; lp.X = Math.Atan2(x, -y); } else { lp.Y = c_rh - ProjectionMath.PiHalf; lp.X = Math.Atan2(x, y); } } else { double c, Az, cosAz, A, B, D, E, F, psi, t; int i; if ((c = ProjectionMath.Distance(x, y)) < EPS10) { lp.Y = ProjectionLatitude; lp.X = 0.0; return(lp); } if (Mode == AzimuthalMode.Oblique || Mode == AzimuthalMode.Equator) { cosAz = Math.Cos(Az = Math.Atan2(x, y)); t = _cosphi0 * cosAz; B = EccentricitySquared * t / _oneEs; A = -B * t; B *= 3.0 * (1.0 - A) * _sinphi0; D = c / _n1; E = D * (1.0 - D * D * (A * (1.0 + A) / 6.0 + B * (1.0 + 3.0 * A) * D / 24.0)); F = 1.0 - E * E * (A / 2.0 + B * E / 6.0); psi = ProjectionMath.Asin(_sinphi0 * Math.Cos(E) + t * Math.Sin(E)); lp.X = ProjectionMath.Asin(Math.Sin(Az) * Math.Sin(E) / Math.Cos(psi)); if ((t = Math.Abs(psi)) < EPS10) { lp.Y = 00.0; } else if (Math.Abs(t - ProjectionMath.PiHalf) < 0.0) { lp.Y = ProjectionMath.PiHalf; } else { lp.Y = Math.Atan((1.0 - EccentricitySquared * F * _sinphi0 / Math.Sin(psi)) * Math.Tan(psi) / _oneEs); } } else { lp.Y = ProjectionMath.inv_mlfn(Mode == AzimuthalMode.NorthPole ? _mp - c : _mp + c, EccentricitySquared, _en); lp.X = Math.Atan2(x, Mode == AzimuthalMode.NorthPole ? -y : y); } } return(lp); }
public override Coordinate Project(double lplam, double lpphi, Coordinate xy) { int l, nn; double lamt = 0, xlam, sdsq, c, d, s, lamdp = 0, phidp, lampp, tanph, lamtp, cl, sd, sp, fac, sav, tanphi; if (lpphi > ProjectionMath.PiHalf) { lpphi = ProjectionMath.PiHalf; } else if (lpphi < -ProjectionMath.PiHalf) { lpphi = -ProjectionMath.PiHalf; } lampp = lpphi >= 0.0 ? ProjectionMath.PiHalf : PI_HALFPI; tanphi = Math.Tan(lpphi); for (nn = 0; ;) { sav = lampp; lamtp = lplam + p22 * lampp; cl = Math.Cos(lamtp); if (Math.Abs(cl) < Tolerance) { lamtp -= Tolerance; } fac = lampp - Math.Sin(lampp) * (cl < 0.0 ? -ProjectionMath.PiHalf : ProjectionMath.PiHalf); for (l = 50; l > 0; --l) { lamt = lplam + p22 * sav; if (Math.Abs(c = Math.Cos(lamt)) < Tolerance) { lamt -= Tolerance; } xlam = (_oneEs * tanphi * sa + Math.Sin(lamt) * ca) / c; lamdp = Math.Atan(xlam) + fac; if (Math.Abs(Math.Abs(sav) - Math.Abs(lamdp)) < Tolerance) { break; } sav = lamdp; } if (l == 0 || ++nn >= 3 || (lamdp > rlm && lamdp < rlm2)) { break; } if (lamdp <= rlm) { lampp = TWOPI_HALFPI; } else if (lamdp >= rlm2) { lampp = ProjectionMath.PiHalf; } } if (l != 0) { sp = Math.Sin(lpphi); phidp = ProjectionMath.Asin((_oneEs * ca * sp - sa * Math.Cos(lpphi) * Math.Sin(lamt)) / Math.Sqrt(1.0 - EccentricitySquared * sp * sp)); tanph = Math.Log(Math.Tan(ProjectionMath.PiFourth + .5 * phidp)); sd = Math.Sin(lamdp); sdsq = sd * sd; s = p22 * sa * Math.Cos(lamdp) * Math.Sqrt((1.0 + t * sdsq) / ((1.0 + w * sdsq) * (1.0 + q * sdsq))); d = Math.Sqrt(xj * xj + s * s); xy.X = b * lamdp + a2 * Math.Sin(2.0 * lamdp) + a4 * Math.Sin(lamdp * 4.0) - tanph * s / d; xy.Y = c1 * sd + c3 * Math.Sin(lamdp * 3.0) + tanph * xj / d; } else { xy.X = xy.Y = Double.PositiveInfinity; } return(xy); }