/src/PROJ/src/projections/boggs.cpp
Line | Count | Source |
1 | | |
2 | | #include <math.h> |
3 | | |
4 | | #include "proj.h" |
5 | | #include "proj_internal.h" |
6 | | |
7 | | PROJ_HEAD(boggs, "Boggs Eumorphic") "\n\tPCyl, no inv, Sph"; |
8 | 0 | #define NITER 20 |
9 | 0 | #define EPS 1e-7 |
10 | 0 | #define FXC 2.00276 |
11 | 0 | #define FXC2 1.11072 |
12 | 0 | #define FYC 0.49931 |
13 | | |
14 | 0 | static PJ_XY boggs_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */ |
15 | 0 | PJ_XY xy = {0.0, 0.0}; |
16 | 0 | double theta, th1, c; |
17 | 0 | int i; |
18 | 0 | (void)P; |
19 | |
|
20 | 0 | theta = lp.phi; |
21 | 0 | if (fabs(fabs(lp.phi) - M_HALFPI) < EPS) |
22 | 0 | xy.x = 0.; |
23 | 0 | else { |
24 | 0 | c = sin(theta) * M_PI; |
25 | 0 | for (i = NITER; i; --i) { |
26 | 0 | th1 = (theta + sin(theta) - c) / (1. + cos(theta)); |
27 | 0 | theta -= th1; |
28 | 0 | if (fabs(th1) < EPS) |
29 | 0 | break; |
30 | 0 | } |
31 | 0 | theta *= 0.5; |
32 | 0 | xy.x = FXC * lp.lam / (1. / cos(lp.phi) + FXC2 / cos(theta)); |
33 | 0 | } |
34 | 0 | xy.y = FYC * (lp.phi + M_SQRT2 * sin(theta)); |
35 | 0 | return (xy); |
36 | 0 | } |
37 | | |
38 | 32 | PJ *PJ_PROJECTION(boggs) { |
39 | 32 | P->es = 0.; |
40 | 32 | P->fwd = boggs_s_forward; |
41 | 32 | return P; |
42 | 32 | } |
43 | | |
44 | | #undef NITER |
45 | | #undef EPS |
46 | | #undef FXC |
47 | | #undef FXC2 |
48 | | #undef FYC |