PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Proj4/PJ_crast.c

http://github.com/route-me/route-me
C | 25 lines | 25 code | 0 blank | 0 comment | 1 complexity | 9fbcb4cc222e8e59cb56dd42427d581c MD5 | raw file
 1#ifndef lint
 2static const char SCCSID[]="@(#)PJ_crast.c	4.1 94/02/15     GIE     REL";
 3#endif
 4#define PJ_LIB__
 5# include	"projects.h"
 6PROJ_HEAD(crast, "Craster Parabolic (Putnins P4)")
 7"\n\tPCyl., Sph.";
 8#define XM	0.97720502380583984317
 9#define RXM	1.02332670794648848847
10#define YM	3.06998012383946546542
11#define RYM	0.32573500793527994772
12#define THIRD	0.333333333333333333
13FORWARD(s_forward); /* spheroid */
14	lp.phi *= THIRD;
15	xy.x = XM * lp.lam * (2. * cos(lp.phi + lp.phi) - 1.);
16	xy.y = YM * sin(lp.phi);
17	return (xy);
18}
19INVERSE(s_inverse); /* spheroid */
20	lp.phi = 3. * asin(xy.y * RYM);
21	lp.lam = xy.x * RXM / (2. * cos((lp.phi + lp.phi) * THIRD) - 1);
22	return (lp);
23}
24FREEUP; if (P) pj_dalloc(P); }
25ENTRY0(crast) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)