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