Line | Count | Source |
1 | | /* determine small t */ |
2 | | #include "proj.h" |
3 | | #include "proj_internal.h" |
4 | | #include <math.h> |
5 | | |
6 | 1.42k | double pj_tsfn(double phi, double sinphi, double e) { |
7 | | /**************************************************************************** |
8 | | * Determine function ts(phi) defined in Snyder (1987), Eq. (7-10) |
9 | | * Inputs: |
10 | | * phi = geographic latitude (radians) |
11 | | * e = eccentricity of the ellipsoid (dimensionless) |
12 | | * Output: |
13 | | * ts = exp(-psi) where psi is the isometric latitude (dimensionless) |
14 | | * = 1 / (tan(chi) + sec(chi)) |
15 | | * Here isometric latitude is defined by |
16 | | * psi = log( tan(pi/4 + phi/2) * |
17 | | * ( (1 - e*sin(phi)) / (1 + e*sin(phi)) )^(e/2) ) |
18 | | * = asinh(tan(phi)) - e * atanh(e * sin(phi)) |
19 | | * = asinh(tan(chi)) |
20 | | * chi = conformal latitude |
21 | | ***************************************************************************/ |
22 | | |
23 | 1.42k | double cosphi = cos(phi); |
24 | | // exp(-asinh(tan(phi))) = 1 / (tan(phi) + sec(phi)) |
25 | | // = cos(phi) / (1 + sin(phi)) good for phi > 0 |
26 | | // = (1 - sin(phi)) / cos(phi) good for phi < 0 |
27 | 1.42k | return exp(e * atanh(e * sinphi)) * |
28 | 1.42k | (sinphi > 0 ? cosphi / (1 + sinphi) : (1 - sinphi) / cosphi); |
29 | 1.42k | } |