svn-gvsig-desktop / trunk / libraries / libjni-proj4 / src / PJ_hatano.c @ 7098
History | View | Annotate | Download (1.41 KB)
1 |
#ifndef lint
|
---|---|
2 |
static const char SCCSID[]="@(#)PJ_hatano.c 4.1 94/02/15 GIE REL"; |
3 |
#endif
|
4 |
#define PJ_LIB__
|
5 |
#include <projects.h> |
6 |
PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") "\n\tPCyl, Sph."; |
7 |
#define NITER 20 |
8 |
#define EPS 1e-7 |
9 |
#define ONETOL 1.000001 |
10 |
#define CN 2.67595 |
11 |
#define CS 2.43763 |
12 |
#define RCN 0.37369906014686373063 |
13 |
#define RCS 0.41023453108141924738 |
14 |
#define FYCN 1.75859 |
15 |
#define FYCS 1.93052 |
16 |
#define RYCN 0.56863737426006061674 |
17 |
#define RYCS 0.51799515156538134803 |
18 |
#define FXC 0.85 |
19 |
#define RXC 1.17647058823529411764 |
20 |
FORWARD(s_forward); /* spheroid */
|
21 |
double th1, c;
|
22 |
int i;
|
23 |
|
24 |
c = sin(lp.phi) * (lp.phi < 0. ? CS : CN);
|
25 |
for (i = NITER; i; --i) {
|
26 |
lp.phi -= th1 = (lp.phi + sin(lp.phi) - c) / (1. + cos(lp.phi));
|
27 |
if (fabs(th1) < EPS) break; |
28 |
} |
29 |
xy.x = FXC * lp.lam * cos(lp.phi *= .5);
|
30 |
xy.y = sin(lp.phi) * (lp.phi < 0. ? FYCS : FYCN);
|
31 |
return (xy);
|
32 |
} |
33 |
INVERSE(s_inverse); /* spheroid */
|
34 |
double th;
|
35 |
|
36 |
th = xy.y * ( xy.y < 0. ? RYCS : RYCN);
|
37 |
if (fabs(th) > 1.) |
38 |
if (fabs(th) > ONETOL) I_ERROR
|
39 |
else th = th > 0. ? HALFPI : - HALFPI; |
40 |
else
|
41 |
th = asin(th); |
42 |
lp.lam = RXC * xy.x / cos(th); |
43 |
th += th; |
44 |
lp.phi = (th + sin(th)) * (xy.y < 0. ? RCS : RCN);
|
45 |
if (fabs(lp.phi) > 1.) |
46 |
if (fabs(lp.phi) > ONETOL) I_ERROR
|
47 |
else lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; |
48 |
else
|
49 |
lp.phi = asin(lp.phi); |
50 |
return (lp);
|
51 |
} |
52 |
FREEUP; if (P) pj_dalloc(P); }
|
53 |
ENTRY0(hatano) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)
|