svn-gvsig-desktop / tags / tmp_build_del / libraries / libjni-proj4 / src / PJ_nell_h.c @ 38629
History | View | Annotate | Download (825 Bytes)
1 |
#ifndef lint
|
---|---|
2 |
static const char SCCSID[]="@(#)PJ_nell_h.c 4.1 94/02/15 GIE REL"; |
3 |
#endif
|
4 |
#define PJ_LIB__
|
5 |
# include <projects.h> |
6 |
PROJ_HEAD(nell_h, "Nell-Hammer") "\n\tPCyl., Sph."; |
7 |
#define NITER 9 |
8 |
#define EPS 1e-7 |
9 |
FORWARD(s_forward); /* spheroid */
|
10 |
xy.x = 0.5 * lp.lam * (1. + cos(lp.phi)); |
11 |
xy.y = 2.0 * (lp.phi - tan(0.5 *lp.phi)); |
12 |
return (xy);
|
13 |
} |
14 |
INVERSE(s_inverse); /* spheroid */
|
15 |
double V, c, p;
|
16 |
int i;
|
17 |
|
18 |
p = 0.5 * xy.y; |
19 |
for (i = NITER; i ; --i) {
|
20 |
c = cos(0.5 * lp.phi); |
21 |
lp.phi -= V = (lp.phi - tan(lp.phi/2) - p)/(1. - 0.5/(c*c)); |
22 |
if (fabs(V) < EPS)
|
23 |
break;
|
24 |
} |
25 |
if (!i) {
|
26 |
lp.phi = p < 0. ? -HALFPI : HALFPI;
|
27 |
lp.lam = 2. * xy.x;
|
28 |
} else
|
29 |
lp.lam = 2. * xy.x / (1. + cos(lp.phi)); |
30 |
return (lp);
|
31 |
} |
32 |
FREEUP; if (P) pj_dalloc(P); }
|
33 |
ENTRY0(nell_h) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)
|