diff options
| author | Kurt Schwehr <schwehr@google.com> | 2018-05-19 11:40:59 -0700 |
|---|---|---|
| committer | Kurt Schwehr <schwehr@google.com> | 2018-05-19 11:40:59 -0700 |
| commit | 9f9b4505be5cb2006f363e1c0616e586b9d66a3d (patch) | |
| tree | 4488b2e18091416a351c1d9ed00e5a2ca06ec186 /src | |
| parent | cb668057bb8c1fad0f5560765770646e1a556406 (diff) | |
| download | PROJ-9f9b4505be5cb2006f363e1c0616e586b9d66a3d.tar.gz PROJ-9f9b4505be5cb2006f363e1c0616e586b9d66a3d.zip | |
Partial clean isea defines and includes
- Move includes to the top
- Move #defines to the top after includes
- Get M_PI and DEG90 from projects.h
Diffstat (limited to 'src')
| -rw-r--r-- | src/PJ_isea.c | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/src/PJ_isea.c b/src/PJ_isea.c index b982d11e..769b1837 100644 --- a/src/PJ_isea.c +++ b/src/PJ_isea.c @@ -3,15 +3,49 @@ * and is in the public domain. */ +#include <errno.h> #include <float.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef M_PI -# define M_PI 3.14159265358979323846 -#endif +#define PJ_LIB__ +#include "proj.h" +#include "projects.h" + +#define DEG36 0.62831853071795864768 +#define DEG72 1.25663706143591729537 +#define DEG90 M_PI_2 +#define DEG108 1.88495559215387594306 +#define DEG120 2.09439510239319549229 +#define DEG144 2.51327412287183459075 +#define DEG180 M_PI + +/* sqrt(5)/M_PI */ +#define ISEA_SCALE 0.8301572857837594396028083 + +/* 26.565051177 degrees */ +#define V_LAT 0.46364760899944494524 + +/* 52.62263186 */ +#define E_RAD 0.91843818702186776133 + +/* 10.81231696 */ +#define F_RAD 0.18871053072122403508 + +/* R tan(g) sin(60) */ +#define TABLE_G 0.6615845383 + +/* H = 0.25 R tan g = */ +#define TABLE_H 0.1909830056 + +/* in radians */ +#define ISEA_STD_LAT 1.01722196792335072101 +#define ISEA_STD_LON .19634954084936207740 + +#define RAD2DEG (180.0/M_PI) +#define DEG2RAD (M_PI/180.0) struct hex { int iso; @@ -145,22 +179,6 @@ static const struct snyder_constants constants[] = { {37.37736814, 36.0, 30.0, 17.27, 1.163, 0.860, 13.14, 1.584, 1.0}, }; -#define DEG120 2.09439510239319549229 -#define DEG72 1.25663706143591729537 -#define DEG90 1.57079632679489661922 -#define DEG144 2.51327412287183459075 -#define DEG36 0.62831853071795864768 -#define DEG108 1.88495559215387594306 -#define DEG180 M_PI -/* sqrt(5)/M_PI */ -#define ISEA_SCALE 0.8301572857837594396028083 - -/* 26.565051177 degrees */ -#define V_LAT 0.46364760899944494524 - -#define RAD2DEG (180.0/M_PI) -#define DEG2RAD (M_PI/180.0) - static struct isea_geo vertex[] = { {0.0, DEG90}, {DEG180, V_LAT}, @@ -180,12 +198,6 @@ static struct isea_geo vertex[] = { static int tri_v1[] = {0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 2, 3, 4, 5, 1, 11, 11, 11, 11, 11}; -/* 52.62263186 */ -#define E_RAD 0.91843818702186776133 - -/* 10.81231696 */ -#define F_RAD 0.18871053072122403508 - /* triangle Centers */ static const struct isea_geo icostriangles[] = { {0.0, 0.0}, @@ -229,12 +241,6 @@ static double az_adjustment(int triangle) return adj; } -/* R tan(g) sin(60) */ -#define TABLE_G 0.6615845383 - -/* H = 0.25 R tan g = */ -#define TABLE_H 0.1909830056 - static struct isea_pt isea_triangle_xy(int triangle) { struct isea_pt c; @@ -549,10 +555,6 @@ static struct isea_geo isea_ctran(struct isea_geo * np, struct isea_geo * pt, return npt; } -/* in radians */ -#define ISEA_STD_LAT 1.01722196792335072101 -#define ISEA_STD_LON .19634954084936207740 - /* fuller's at 5.2454 west, 2.3009 N, adjacent at 7.46658 deg */ static int isea_grid_init(struct isea_dgg * g) @@ -965,15 +967,11 @@ static struct isea_pt isea_forward(struct isea_dgg *g, struct isea_geo *in) return out; } + /* * Proj 4 integration code follows */ -#define PJ_LIB__ -#include <errno.h> -#include "proj.h" -#include "projects.h" - PROJ_HEAD(isea, "Icosahedral Snyder Equal Area") "\n\tSph"; struct pj_opaque { |
