diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-09-27 15:58:54 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-09-27 16:19:56 +0200 |
| commit | 5e7d58ec69764f7ffa8d09991aa0b0102d2f02ab (patch) | |
| tree | 688a99b9686d7c90397ca04bd8bf40b0c6a231d7 /src/projections | |
| parent | fedeeec68ff6a65126da35ae54ec75a719ff40ce (diff) | |
| download | PROJ-5e7d58ec69764f7ffa8d09991aa0b0102d2f02ab.tar.gz PROJ-5e7d58ec69764f7ffa8d09991aa0b0102d2f02ab.zip | |
Ortho ellipsoidal inverse: improve accuracy in polar case with (x,y) close to (0,0)
Diffstat (limited to 'src/projections')
| -rw-r--r-- | src/projections/ortho.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/projections/ortho.cpp b/src/projections/ortho.cpp index b4ecff7f..555f3f71 100644 --- a/src/projections/ortho.cpp +++ b/src/projections/ortho.cpp @@ -171,7 +171,7 @@ static PJ_LP ortho_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inver // ==> lam = atan2(xy.x, -xy.y * sign(phi0)) // ==> xy.x^2 + xy.y^2 = nu^2 * cosphi^2 // rh^2 = cosphi^2 / (1 - es * sinphi^2) - // ==> sinphi^2 = (1 - rh^2) / (1 - es * rh^2) + // ==> cosphi^2 = rh^2 * (1 - es) / (1 - es * rh^2) const double rh2 = SQ(xy.x) + SQ(xy.y); if (rh2 >= 1. - 1e-15) { @@ -184,7 +184,7 @@ static PJ_LP ortho_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inver lp.phi = 0; } else { - lp.phi = asin(sqrt((1 - rh2) / (1 - P->es * rh2))) * (Q->mode == N_POLE ? 1 : -1); + lp.phi = acos(sqrt(rh2 * P->one_es / (1 - P->es * rh2))) * (Q->mode == N_POLE ? 1 : -1); } lp.lam = atan2(xy.x, xy.y * (Q->mode == N_POLE ? -1 : 1)); return lp; |
