/src/proj/src/projections/tcea.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | |
3 | | #include <math.h> |
4 | | |
5 | | #include "proj.h" |
6 | | #include "proj_internal.h" |
7 | | |
8 | | PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") "\n\tCyl, Sph"; |
9 | | |
10 | 0 | static PJ_XY tcea_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */ |
11 | 0 | PJ_XY xy = {0.0, 0.0}; |
12 | 0 | xy.x = cos(lp.phi) * sin(lp.lam) / P->k0; |
13 | 0 | xy.y = P->k0 * (atan2(tan(lp.phi), cos(lp.lam)) - P->phi0); |
14 | 0 | return xy; |
15 | 0 | } |
16 | | |
17 | 0 | static PJ_LP tcea_s_inverse(PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ |
18 | 0 | PJ_LP lp = {0.0, 0.0}; |
19 | 0 | double t; |
20 | |
|
21 | 0 | xy.y = xy.y / P->k0 + P->phi0; |
22 | 0 | xy.x *= P->k0; |
23 | 0 | t = sqrt(1. - xy.x * xy.x); |
24 | 0 | lp.phi = asin(t * sin(xy.y)); |
25 | 0 | lp.lam = atan2(xy.x, t * cos(xy.y)); |
26 | 0 | return lp; |
27 | 0 | } |
28 | | |
29 | 31 | PJ *PJ_PROJECTION(tcea) { |
30 | 31 | P->inv = tcea_s_inverse; |
31 | 31 | P->fwd = tcea_s_forward; |
32 | 31 | P->es = 0.; |
33 | 31 | return P; |
34 | 31 | } |