/src/proj/src/projections/tcc.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(tcc, "Transverse Central Cylindrical") "\n\tCyl, Sph, no inv"; |
9 | | |
10 | 0 | #define EPS10 1.e-10 |
11 | | |
12 | 0 | static PJ_XY tcc_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */ |
13 | 0 | PJ_XY xy = {0.0, 0.0}; |
14 | |
|
15 | 0 | const double b = cos(lp.phi) * sin(lp.lam); |
16 | 0 | const double bt = 1. - b * b; |
17 | 0 | if (bt < EPS10) { |
18 | 0 | proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); |
19 | 0 | return xy; |
20 | 0 | } |
21 | 0 | xy.x = b / sqrt(bt); |
22 | 0 | xy.y = atan2(tan(lp.phi), cos(lp.lam)); |
23 | 0 | return xy; |
24 | 0 | } |
25 | | |
26 | 84 | PJ *PJ_PROJECTION(tcc) { |
27 | 84 | P->es = 0.; |
28 | 84 | P->fwd = tcc_s_forward; |
29 | 84 | P->inv = nullptr; |
30 | | |
31 | 84 | return P; |
32 | 84 | } |