PJ_sts.c
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#define PROJ_PARMS__ \
double C_x, C_y, C_p; \
int tan_mode;
#define PJ_LIB__
# include <projects.h>
PROJ_HEAD(kav5, "Kavraisky V") "\n\tPCyl., Sph.";
PROJ_HEAD(qua_aut, "Quartic Authalic") "\n\tPCyl., Sph.";
PROJ_HEAD(mbt_s, "McBryde-Thomas Flat-Polar Sine (No. 1)") "\n\tPCyl., Sph.";
PROJ_HEAD(fouc, "Foucaut") "\n\tPCyl., Sph.";
FORWARD(s_forward); /* spheroid */
double c;
xy.x = P->C_x * lp.lam * cos(lp.phi);
xy.y = P->C_y;
lp.phi *= P->C_p;
c = cos(lp.phi);
if (P->tan_mode) {
xy.x *= c * c;
xy.y *= tan(lp.phi);
} else {
xy.x /= c;
xy.y *= sin(lp.phi);
}
return (xy);
}
INVERSE(s_inverse); /* spheroid */
double c;
xy.y /= P->C_y;
c = cos(lp.phi = P->tan_mode ? atan(xy.y) : aasin(xy.y));
lp.phi /= P->C_p;
lp.lam = xy.x / (P->C_x * cos(lp.phi));
if (P->tan_mode)
lp.lam /= c * c;
else
lp.lam *= c;
return (lp);
}
FREEUP; if (P) pj_dalloc(P); }
static PJ *
setup(PJ *P, double p, double q, int mode) {
P->es = 0.;
P->inv = s_inverse;
P->fwd = s_forward;
P->C_x = q / p;
P->C_y = p;
P->C_p = 1/ q;
P->tan_mode = mode;
return P;
}
ENTRY0(kav5) ENDENTRY(setup(P, 1.50488, 1.35439, 0))
ENTRY0(qua_aut) ENDENTRY(setup(P, 2., 2., 0))
ENTRY0(mbt_s) ENDENTRY(setup(P, 1.48875, 1.36509, 0))
ENTRY0(fouc) ENDENTRY(setup(P, 2., 2., 1))