PageRenderTime 15ms CodeModel.GetById 6ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Proj4/PJ_hammer.c

http://github.com/route-me/route-me
C | 32 lines | 31 code | 1 blank | 0 comment | 5 complexity | 036a70cbbdc0292eb81c572020dabdf0 MD5 | raw file
 1#ifndef lint
 2static 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"
 9PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff")
10	"\n\tMisc Sph, no inv.\n\tW= M=";
11FORWARD(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}
19FREEUP; if (P) pj_dalloc(P); }
20ENTRY0(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;
32ENDENTRY(P)