/src/PROJ/src/projections/wag2.cpp
Line | Count | Source |
1 | | |
2 | | |
3 | | #include <math.h> |
4 | | |
5 | | #include "proj.h" |
6 | | #include "proj_internal.h" |
7 | | |
8 | | PROJ_HEAD(wag2, "Wagner II") "\n\tPCyl, Sph"; |
9 | | |
10 | 2.85k | #define C_x 0.92483 |
11 | 2.85k | #define C_y 1.38725 |
12 | 2.85k | #define C_p1 0.88022 |
13 | 2.85k | #define C_p2 0.88550 |
14 | | |
15 | 2.85k | static PJ_XY wag2_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */ |
16 | 2.85k | PJ_XY xy = {0.0, 0.0}; |
17 | 2.85k | lp.phi = aasin(P->ctx, C_p1 * sin(C_p2 * lp.phi)); |
18 | 2.85k | xy.x = C_x * lp.lam * cos(lp.phi); |
19 | 2.85k | xy.y = C_y * lp.phi; |
20 | 2.85k | return (xy); |
21 | 2.85k | } |
22 | | |
23 | 0 | static PJ_LP wag2_s_inverse(PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ |
24 | 0 | PJ_LP lp = {0.0, 0.0}; |
25 | 0 | lp.phi = xy.y / C_y; |
26 | 0 | lp.lam = xy.x / (C_x * cos(lp.phi)); |
27 | 0 | lp.phi = aasin(P->ctx, sin(lp.phi) / C_p1) / C_p2; |
28 | 0 | return (lp); |
29 | 0 | } |
30 | | |
31 | 73 | PJ *PJ_PROJECTION(wag2) { |
32 | 73 | P->es = 0.; |
33 | 73 | P->inv = wag2_s_inverse; |
34 | 73 | P->fwd = wag2_s_forward; |
35 | 73 | return P; |
36 | 73 | } |
37 | | |
38 | | #undef C_x |
39 | | #undef C_y |
40 | | #undef C_p1 |
41 | | #undef C_p2 |