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

/Proj4/PJ_bacon.c

http://github.com/route-me/route-me
C | 44 lines | 43 code | 1 blank | 0 comment | 6 complexity | 370e6e8a722f3740fefc666d9639419c MD5 | raw file
 1#ifndef lint
 2static const char SCCSID[]="@(#)PJ_bacon.c	4.1	94/02/15	GIE	REL";
 3#endif
 4# define HLFPI2	2.46740110027233965467
 5# define EPS	1e-10
 6#define PROJ_PARMS__ \
 7	int bacn; \
 8	int ortl;
 9#define PJ_LIB__
10#include	"projects.h"
11PROJ_HEAD(apian, "Apian Globular I") "\n\tMisc Sph, no inv.";
12PROJ_HEAD(ortel, "Ortelius Oval") "\n\tMisc Sph, no inv.";
13PROJ_HEAD(bacon, "Bacon Globular") "\n\tMisc Sph, no inv.";
14FORWARD(s_forward); /* spheroid */
15	double ax, f;
16
17	xy.y = P->bacn ? HALFPI * sin(lp.phi) : lp.phi;
18	if ((ax = fabs(lp.lam)) >= EPS) {
19		if (P->ortl && ax >= HALFPI)
20			xy.x = sqrt(HLFPI2 - lp.phi * lp.phi + EPS) + ax - HALFPI;
21		else {
22			f = 0.5 * (HLFPI2 / ax + ax);
23			xy.x = ax - f + sqrt(f * f - xy.y * xy.y);
24		}
25		if (lp.lam < 0.) xy.x = - xy.x;
26	} else
27		xy.x = 0.;
28	return (xy);
29}
30FREEUP; if (P) pj_dalloc(P); }
31ENTRY0(bacon)
32	P->bacn = 1;
33	P->ortl = 0;
34	P->es = 0.; P->fwd = s_forward;
35ENDENTRY(P)
36ENTRY0(apian)
37	P->bacn = P->ortl = 0;
38	P->es = 0.; P->fwd = s_forward;
39ENDENTRY(P)
40ENTRY0(ortel)
41	P->bacn = 0;
42	P->ortl = 1;
43	P->es = 0.; P->fwd = s_forward;
44ENDENTRY(P)