diff options
| -rw-r--r-- | src/projections/imw_p.cpp | 14 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 19 |
2 files changed, 28 insertions, 5 deletions
diff --git a/src/projections/imw_p.cpp b/src/projections/imw_p.cpp index 41882df2..8d675318 100644 --- a/src/projections/imw_p.cpp +++ b/src/projections/imw_p.cpp @@ -117,12 +117,16 @@ static PJ_LP e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse */ do { t = loc_for(lp, P, &yc); const double denom = t.y - yc; - if( denom == 0 ) { - proj_errno_set(P, PJD_ERR_NON_CONVERGENT); - return proj_coord_error().lp; + if( denom != 0 || fabs(t.y - xy.y) > TOL ) + { + if( denom == 0 ) { + proj_errno_set(P, PJD_ERR_NON_CONVERGENT); + return proj_coord_error().lp; + } + lp.phi = ((lp.phi - Q->phi_1) * (xy.y - yc) / denom) + Q->phi_1; } - lp.phi = ((lp.phi - Q->phi_1) * (xy.y - yc) / denom) + Q->phi_1; - lp.lam = lp.lam * xy.x / t.x; + if( t.x != 0 || fabs(t.x - xy.x) > TOL ) + lp.lam = lp.lam * xy.x / t.x; i ++; } while (i < N_MAX_ITER && (fabs(t.x - xy.x) > TOL || fabs(t.y - xy.y) > TOL)); diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 6044f47e..5cbe6325 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2115,6 +2115,25 @@ expect -0.001796699 0.500904924 accept -200 -100 expect -0.001796698 0.499095076 +------------------------------------------------------------------------------- +operation +proj=imw_p +ellps=GRS80 +lat_1=0 +lat_2=10 +------------------------------------------------------------------------------- +tolerance 0.1 mm +accept 0 0 +expect 0 0 +accept 0.000000000000 0.000904928485 +expect 0 100 +accept 0.000898315284 0.000000000000 +expect 100 0 + +direction inverse +accept 0 0 +expect 0 0 +accept 0 100 +expect 0.000000000000 0.000904928485 +accept 100 0 +expect 0.000898315284 0.000000000000 + =============================================================================== Icosahedral Snyder Equal Area |
