svn-gvsig-desktop / tags / gvsig_redes-1_0_0-1235 / libraries / libjni-proj4 / src / PJ_eck2.c @ 44116
History | View | Annotate | Download (932 Bytes)
1 |
#ifndef lint
|
---|---|
2 |
static const char SCCSID[]="@(#)PJ_eck2.c 4.1 94/02/15 GIE REL"; |
3 |
#endif
|
4 |
#define PJ_LIB__
|
5 |
# include <projects.h> |
6 |
PROJ_HEAD(eck2, "Eckert II") "\n\tPCyl. Sph."; |
7 |
#define FXC 0.46065886596178063902 |
8 |
#define FYC 1.44720250911653531871 |
9 |
#define C13 0.33333333333333333333 |
10 |
#define ONEEPS 1.0000001 |
11 |
FORWARD(s_forward); /* spheroid */
|
12 |
xy.x = FXC * lp.lam * (xy.y = sqrt(4. - 3. * sin(fabs(lp.phi)))); |
13 |
xy.y = FYC * (2. - xy.y);
|
14 |
if ( lp.phi < 0.) xy.y = -xy.y; |
15 |
return (xy);
|
16 |
} |
17 |
INVERSE(s_inverse); /* spheroid */
|
18 |
lp.lam = xy.x / (FXC * ( lp.phi = 2. - fabs(xy.y) / FYC) );
|
19 |
lp.phi = (4. - lp.phi * lp.phi) * C13;
|
20 |
if (fabs(lp.phi) >= 1.) { |
21 |
if (fabs(lp.phi) > ONEEPS) I_ERROR
|
22 |
else
|
23 |
lp.phi = lp.phi < 0. ? -HALFPI : HALFPI;
|
24 |
} else
|
25 |
lp.phi = asin(lp.phi); |
26 |
if (xy.y < 0) |
27 |
lp.phi = -lp.phi; |
28 |
return (lp);
|
29 |
} |
30 |
FREEUP; if (P) pj_dalloc(P); }
|
31 |
ENTRY0(eck2); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)
|