diff --git a/src/lib/proj4lib/include/proj4.h b/src/lib/proj4lib/include/proj4.h index 9298ccba..c6732245 100644 --- a/src/lib/proj4lib/include/proj4.h +++ b/src/lib/proj4lib/include/proj4.h @@ -7,6 +7,7 @@ #ifndef PROJ4_H #define PROJ4_H +#define _USE_MATH_DEFINES #include #include /* @@ -21,13 +22,17 @@ extern long double usgs_hypot(long double, long double); /* some useful constants */ -#define FORTPI M_PI_4 -#define PI M_PI -#define TWOPI 6.28318530717958647692528676655900576L +#define FORTPI M_PI_4 +#define PI M_PI +#define TWOPI 6.28318530717958647692528676655900576L #define RAD_TO_DEG M_180_PI #define DEG_TO_RAD M_PI_180 -typedef union { long double f; int i; char *s; } PVALUE; +typedef union { + long double f; + int i; + char *s; +} PVALUE; /* procedure prototypes */ @@ -49,4 +54,3 @@ long double pj_authlat(long double, long double *); */ #endif - diff --git a/src/lib/proj4lib/lib/adjlon.cpp b/src/lib/proj4lib/lib/adjlon.cpp index 3cf84016..8877f245 100644 --- a/src/lib/proj4lib/lib/adjlon.cpp +++ b/src/lib/proj4lib/lib/adjlon.cpp @@ -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 /* 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); } diff --git a/src/lib/proj4lib/lib/pj_phi2.cpp b/src/lib/proj4lib/lib/pj_phi2.cpp index 564a99bd..bb7dd426 100644 --- a/src/lib/proj4lib/lib/pj_phi2.cpp +++ b/src/lib/proj4lib/lib/pj_phi2.cpp @@ -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 #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; } diff --git a/src/lib/proj4lib/lib/pj_qsfn.cpp b/src/lib/proj4lib/lib/pj_qsfn.cpp index fc8d50e4..3a265684 100644 --- a/src/lib/proj4lib/lib/pj_qsfn.cpp +++ b/src/lib/proj4lib/lib/pj_qsfn.cpp @@ -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 -# 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); } diff --git a/src/lib/proj4lib/lib/pj_tsfn.cpp b/src/lib/proj4lib/lib/pj_tsfn.cpp index 987de3aa..acf9c2a3 100644 --- a/src/lib/proj4lib/lib/pj_tsfn.cpp +++ b/src/lib/proj4lib/lib/pj_tsfn.cpp @@ -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 - 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)); }