-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cmath and/or _USE_MATH_DEFINES for MSVC in proj4 files
- Loading branch information
1 parent
7832a02
commit 11b5a9f
Showing
5 changed files
with
57 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
/* reduce argument to range +/- PI */ | ||
#ifndef lint | ||
//static const char SCCSID[]="@(#)adjlon.c 4.3 93/06/12 GIE REL"; | ||
// static const char SCCSID[]="@(#)adjlon.c 4.3 93/06/12 GIE | ||
// REL"; | ||
#endif | ||
#define _USE_MATH_DEFINES | ||
#include <math.h> | ||
/* note: PI adjusted high | ||
** approx. true val: 3.14159265358979323844 | ||
*/ | ||
#define SPI 3.14159265359 | ||
#define TWOPI 6.2831853071795864769 | ||
long double | ||
adjlon (long double lon) { | ||
while ( fabsl(lon) > SPI ) | ||
lon += lon < 0. ? TWOPI : -TWOPI; | ||
return( lon ); | ||
#define SPI 3.14159265359 | ||
#define TWOPI 6.2831853071795864769 | ||
long double adjlon(long double lon) { | ||
while (fabsl(lon) > SPI) | ||
lon += lon < 0. ? TWOPI : -TWOPI; | ||
return (lon); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
/* determine latitude angle phi-2 */ | ||
#ifndef lint | ||
//static const char SCCSID[]="@(#)pj_phi2.c 4.3 93/06/12 GIE REL"; | ||
// static const char SCCSID[]="@(#)pj_phi2.c 4.3 93/06/12 GIE | ||
// REL"; | ||
#endif | ||
#include "proj4.h" | ||
#define _USE_MATH_DEFINES | ||
#include <math.h> | ||
|
||
#define TOL 1.0e-10 | ||
#define N_ITER 15 | ||
|
||
long double | ||
pj_phi2(long double ts, long double e) { | ||
long double eccnth, Phi, con, dphi; | ||
int i; | ||
long double pj_phi2(long double ts, long double e) { | ||
long double eccnth, Phi, con, dphi; | ||
int i; | ||
|
||
eccnth = .5 * e; | ||
Phi = M_PI_2 - 2. * atan (ts); | ||
i = N_ITER; | ||
do { | ||
con = e * sin (Phi); | ||
dphi = M_PI_2 - 2. * atan (ts * pow((1. - con) / | ||
(1. + con), eccnth)) - Phi; | ||
Phi += dphi; | ||
} while ( fabsl(dphi) > TOL && --i); | ||
/* | ||
if (i <= 0) | ||
pj_errno = -18; | ||
*/ | ||
return Phi; | ||
eccnth = .5 * e; | ||
Phi = M_PI_2 - 2. * atan(ts); | ||
i = N_ITER; | ||
do { | ||
con = e * sin(Phi); | ||
dphi = M_PI_2 - 2. * atan(ts * pow((1. - con) / (1. + con), eccnth)) - Phi; | ||
Phi += dphi; | ||
} while (fabsl(dphi) > TOL && --i); | ||
/* | ||
if (i <= 0) | ||
pj_errno = -18; | ||
*/ | ||
return Phi; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
/* determine small q */ | ||
#ifndef lint | ||
//static const char SCCSID[]="@(#)pj_qsfn.c 4.3 93/06/12 GIE REL"; | ||
// static const char SCCSID[]="@(#)pj_qsfn.c 4.3 93/06/12 GIE | ||
// REL"; | ||
#endif | ||
#define _USE_MATH_DEFINES | ||
#include <math.h> | ||
|
||
# define EPSILON 1.0e-7 | ||
long double | ||
pj_qsfn(long double sinphi, long double e, long double one_es) { | ||
long double con; | ||
#define EPSILON 1.0e-7 | ||
long double pj_qsfn(long double sinphi, long double e, long double one_es) { | ||
long double con; | ||
|
||
if (e >= EPSILON) { | ||
con = e * sinphi; | ||
return (one_es * (sinphi / (1. - con * con) - | ||
(.5 / e) * log ((1. - con) / (1. + con)))); | ||
} else | ||
return (sinphi + sinphi); | ||
if (e >= EPSILON) { | ||
con = e * sinphi; | ||
return (one_es * (sinphi / (1. - con * con) - | ||
(.5 / e) * log((1. - con) / (1. + con)))); | ||
} else | ||
return (sinphi + sinphi); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
/* determine small t */ | ||
#ifndef lint | ||
//static const char SCCSID[]="@(#)pj_tsfn.c 4.3 93/06/12 GIE REL"; | ||
// static const char SCCSID[]="@(#)pj_tsfn.c 4.3 93/06/12 GIE | ||
// REL"; | ||
#endif | ||
#define _USE_MATH_DEFINES | ||
#include <math.h> | ||
long double | ||
pj_tsfn(long double phi, long double sinphi, long double e) { | ||
sinphi *= e; | ||
return (tan (.5 * (M_PI_2 - phi)) / | ||
pow((1. - sinphi) / (1. + sinphi), .5 * e)); | ||
long double pj_tsfn(long double phi, long double sinphi, long double e) { | ||
sinphi *= e; | ||
return (tan(.5 * (M_PI_2 - phi)) / | ||
pow((1. - sinphi) / (1. + sinphi), .5 * e)); | ||
} |