Update to version 1.43 of the geodesic routines. This fixes two
[proj.git] / proj / src / PJ_hammer.c
blob719a2ce451797057469444c53fe8e97b84466f89
1 #define PROJ_PARMS__ \
2 double w; \
3 double m, rm;
4 #define PJ_LIB__
5 # include <projects.h>
6 PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff")
7 "\n\tMisc Sph, no inv.\n\tW= M=";
8 FORWARD(s_forward); /* spheroid */
9 double cosphi, d;
11 d = sqrt(2./(1. + (cosphi = cos(lp.phi)) * cos(lp.lam *= P->w)));
12 xy.x = P->m * d * cosphi * sin(lp.lam);
13 xy.y = P->rm * d * sin(lp.phi);
14 return (xy);
16 FREEUP; if (P) pj_dalloc(P); }
17 ENTRY0(hammer)
18 if (pj_param(P->ctx, P->params, "tW").i) {
19 if ((P->w = fabs(pj_param(P->ctx, P->params, "dW").f)) <= 0.) E_ERROR(-27);
20 } else
21 P->w = .5;
22 if (pj_param(P->ctx, P->params, "tM").i) {
23 if ((P->m = fabs(pj_param(P->ctx, P->params, "dM").f)) <= 0.) E_ERROR(-27);
24 } else
25 P->m = 1.;
26 P->rm = 1. / P->m;
27 P->m /= P->w;
28 P->es = 0.; P->fwd = s_forward;
29 ENDENTRY(P)