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

/Proj4/PJ_tcea.c

http://github.com/route-me/route-me
C | 30 lines | 29 code | 1 blank | 0 comment | 1 complexity | 2ea3ed35277cc32c04a9aa90fc716bfa MD5 | raw file
 1#ifndef lint
 2static const char SCCSID[]="@(#)PJ_tcea.c	4.1	94/02/15	GIE	REL";
 3#endif
 4#define PROJ_PARMS__ \
 5	double rk0;
 6#define PJ_LIB__
 7#include	"projects.h"
 8PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") "\n\tCyl, Sph";
 9FORWARD(s_forward); /* spheroid */
10	xy.x = P->rk0 * cos(lp.phi) * sin(lp.lam);
11	xy.y = P->k0 * (atan2(tan(lp.phi), cos(lp.lam)) - P->phi0);
12	return (xy);
13}
14INVERSE(s_inverse); /* spheroid */
15	double t;
16
17	xy.y = xy.y * P->rk0 + P->phi0;
18	xy.x *= P->k0;
19	t = sqrt(1. - xy.x * xy.x);
20	lp.phi = asin(t * sin(xy.y));
21	lp.lam = atan2(xy.x, t * cos(xy.y));
22	return (lp);
23}
24FREEUP; if (P) pj_dalloc(P); }
25ENTRY0(tcea)
26	P->rk0 = 1 / P->k0;
27	P->inv = s_inverse;
28	P->fwd = s_forward;
29	P->es = 0.;
30ENDENTRY(P)