svn-gvsig-desktop / trunk / libraries / libjni-proj4 / src / PJ_nell.c @ 7098
History | View | Annotate | Download (837 Bytes)
1 |
#ifndef lint
|
---|---|
2 |
static const char SCCSID[]="@(#)PJ_nell.c 4.1 94/02/15 GIE REL"; |
3 |
#endif
|
4 |
#define PJ_LIB__
|
5 |
#include <projects.h> |
6 |
PROJ_HEAD(nell, "Nell") "\n\tPCyl., Sph."; |
7 |
#define MAX_ITER 10 |
8 |
#define LOOP_TOL 1e-7 |
9 |
FORWARD(s_forward); /* spheroid */
|
10 |
double k, V;
|
11 |
int i;
|
12 |
|
13 |
k = 2. * sin(lp.phi);
|
14 |
V = lp.phi * lp.phi; |
15 |
lp.phi *= 1.00371 + V * (-0.0935382 + V * -0.011412); |
16 |
for (i = MAX_ITER; i ; --i) {
|
17 |
lp.phi -= V = (lp.phi + sin(lp.phi) - k) / |
18 |
(1. + cos(lp.phi));
|
19 |
if (fabs(V) < LOOP_TOL)
|
20 |
break;
|
21 |
} |
22 |
xy.x = 0.5 * lp.lam * (1. + cos(lp.phi)); |
23 |
xy.y = lp.phi; |
24 |
return (xy);
|
25 |
} |
26 |
INVERSE(s_inverse); /* spheroid */
|
27 |
double th, s;
|
28 |
|
29 |
lp.lam = 2. * xy.x / (1. + cos(xy.y)); |
30 |
lp.phi = aasin(0.5 * (xy.y + sin(xy.y))); |
31 |
return (lp);
|
32 |
} |
33 |
FREEUP; if (P) pj_dalloc(P); }
|
34 |
ENTRY0(nell) P->es = 0; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)
|