diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2020-12-13 15:30:47 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2020-12-13 15:30:47 +0100 |
| commit | c3efbd23a5bf26f1dfd5bc55ae3488d5665ace98 (patch) | |
| tree | a204df79f7057d7d420bf7c5358791347617b9cd /src/projections/lcc.cpp | |
| parent | 126445148d3b742c7f4e31f5f65857be59c48340 (diff) | |
| parent | 6857d1a4a8eb6fcb7b88b0339413913ba2c3351a (diff) | |
| download | PROJ-c3efbd23a5bf26f1dfd5bc55ae3488d5665ace98.tar.gz PROJ-c3efbd23a5bf26f1dfd5bc55ae3488d5665ace98.zip | |
Merge remote-tracking branch 'osgeo/master'
Diffstat (limited to 'src/projections/lcc.cpp')
| -rw-r--r-- | src/projections/lcc.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/projections/lcc.cpp b/src/projections/lcc.cpp index 91ffc511..525281f4 100644 --- a/src/projections/lcc.cpp +++ b/src/projections/lcc.cpp @@ -80,7 +80,7 @@ static PJ_LP lcc_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse PJ *PROJECTION(lcc) { double cosphi, sinphi; int secant; - struct pj_opaque *Q = static_cast<struct pj_opaque*>(pj_calloc(1, sizeof (struct pj_opaque))); + struct pj_opaque *Q = static_cast<struct pj_opaque*>(calloc(1, sizeof (struct pj_opaque))); if (nullptr == Q) return pj_default_destructor(P, ENOMEM); @@ -106,10 +106,10 @@ PJ *PROJECTION(lcc) { double ml1, m1; m1 = pj_msfn(sinphi, cosphi, P->es); - ml1 = pj_tsfn(Q->phi1, sinphi, P->e); - if( ml1 == 0 ) { + if( fabs(Q->phi1) == M_HALFPI ) { return pj_default_destructor(P, PJD_ERR_LAT_1_OR_2_ZERO_OR_90); } + ml1 = pj_tsfn(Q->phi1, sinphi, P->e); if (secant) { /* secant cone */ sinphi = sin(Q->phi2); Q->n = log(m1 / pj_msfn(sinphi, cos(Q->phi2), P->es)); @@ -117,10 +117,10 @@ PJ *PROJECTION(lcc) { // Not quite, but es is very close to 1... return pj_default_destructor(P, PJD_ERR_INVALID_ECCENTRICITY); } - const double ml2 = pj_tsfn(Q->phi2, sinphi, P->e); - if( ml2 == 0 ) { - return pj_default_destructor(P, PJD_ERR_LAT_1_OR_2_ZERO_OR_90); + if( fabs(Q->phi2) == M_HALFPI ) { + return pj_default_destructor(P, PJD_ERR_LAT_1_OR_2_ZERO_OR_90); } + const double ml2 = pj_tsfn(Q->phi2, sinphi, P->e); const double denom = log(ml1 / ml2); if( denom == 0 ) { // Not quite, but es is very close to 1... |
