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

/Proj4/PJ_collg.c

http://github.com/route-me/route-me
C | 32 lines | 32 code | 0 blank | 0 comment | 6 complexity | a03681b22b038800402f19827eaa81b4 MD5 | raw file
 1#ifndef lint
 2static const char SCCSID[]="@(#)PJ_collg.c	4.1 94/02/15     GIE     REL";
 3#endif
 4#define PJ_LIB__
 5# include	"projects.h"
 6PROJ_HEAD(collg, "Collignon") "\n\tPCyl, Sph.";
 7#define FXC	1.12837916709551257390
 8#define FYC	1.77245385090551602729
 9#define ONEEPS	1.0000001
10FORWARD(s_forward); /* spheroid */
11	if ((xy.y = 1. - sin(lp.phi)) <= 0.)
12		xy.y = 0.;
13	else
14		xy.y = sqrt(xy.y);
15	xy.x = FXC * lp.lam * xy.y;
16	xy.y = FYC * (1. - xy.y);
17	return (xy);
18}
19INVERSE(s_inverse); /* spheroid */
20	lp.phi = xy.y / FYC - 1.;
21	if (fabs(lp.phi = 1. - lp.phi * lp.phi) < 1.)
22		lp.phi = asin(lp.phi);
23	else if (fabs(lp.phi) > ONEEPS) I_ERROR
24	else	lp.phi = lp.phi < 0. ? -HALFPI : HALFPI;
25	if ((lp.lam = 1. - sin(lp.phi)) <= 0.)
26		lp.lam = 0.;
27	else
28		lp.lam = xy.x / (FXC * sqrt(lp.lam));
29	return (lp);
30}
31FREEUP; if (P) pj_dalloc(P); }
32ENTRY0(collg) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)