Statistics
| Revision:

svn-gvsig-desktop / tags / v1_9_Build_1230 / libraries / libjni-proj4 / src / PJ_hammer.c @ 33666

History | View | Annotate | Download (855 Bytes)

1
#ifndef lint
2
static const char SCCSID[]="@(#)PJ_hammer.c        4.1        94/02/15        GIE        REL";
3
#endif
4
#define PROJ_PARMS__ \
5
        double w; \
6
        double m, rm;
7
#define PJ_LIB__
8
# include        <projects.h>
9
PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff")
10
        "\n\tMisc Sph, no inv.\n\tW= M=";
11
FORWARD(s_forward); /* spheroid */
12
        double cosphi, d;
13

    
14
        d = sqrt(2./(1. + (cosphi = cos(lp.phi)) * cos(lp.lam *= P->w)));
15
        xy.x = P->m * d * cosphi * sin(lp.lam);
16
        xy.y = P->rm * d * sin(lp.phi);
17
        return (xy);
18
}
19
FREEUP; if (P) pj_dalloc(P); }
20
ENTRY0(hammer)
21
        if (pj_param(P->params, "tW").i) {
22
                if ((P->w = fabs(pj_param(P->params, "dW").f)) <= 0.) E_ERROR(-27);
23
        } else
24
                P->w = .5;
25
        if (pj_param(P->params, "tM").i) {
26
                if ((P->m = fabs(pj_param(P->params, "dM").f)) <= 0.) E_ERROR(-27);
27
        } else
28
                P->m = 1.;
29
        P->rm = 1. / P->m;
30
        P->m /= P->w;
31
        P->es = 0.; P->fwd = s_forward;
32
ENDENTRY(P)