/src/PROJ/src/projections/cc.cpp
Line | Count | Source |
1 | | |
2 | | |
3 | | #include <math.h> |
4 | | |
5 | | #include "proj.h" |
6 | | #include "proj_internal.h" |
7 | | |
8 | | PROJ_HEAD(cc, "Central Cylindrical") "\n\tCyl, Sph"; |
9 | 92.1k | #define EPS10 1.e-10 |
10 | | |
11 | 92.1k | static PJ_XY cc_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */ |
12 | 92.1k | PJ_XY xy = {0.0, 0.0}; |
13 | 92.1k | if (fabs(fabs(lp.phi) - M_HALFPI) <= EPS10) { |
14 | 0 | proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); |
15 | 0 | return xy; |
16 | 0 | } |
17 | 92.1k | xy.x = lp.lam; |
18 | 92.1k | xy.y = tan(lp.phi); |
19 | 92.1k | return xy; |
20 | 92.1k | } |
21 | | |
22 | 0 | static PJ_LP cc_s_inverse(PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ |
23 | 0 | PJ_LP lp = {0.0, 0.0}; |
24 | 0 | (void)P; |
25 | 0 | lp.phi = atan(xy.y); |
26 | 0 | lp.lam = xy.x; |
27 | 0 | return lp; |
28 | 0 | } |
29 | | |
30 | 855 | PJ *PJ_PROJECTION(cc) { |
31 | 855 | P->es = 0.; |
32 | | |
33 | 855 | P->inv = cc_s_inverse; |
34 | 855 | P->fwd = cc_s_forward; |
35 | | |
36 | 855 | return P; |
37 | 855 | } |