~ubuntu-branches/ubuntu/vivid/proj/vivid

« back to all changes in this revision

Viewing changes to src/PJ_bacon.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter S Galbraith
  • Date: 2002-01-11 10:27:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020111102712-ayi18r8y2eesv0y9
Tags: upstream-4.4.5
ImportĀ upstreamĀ versionĀ 4.4.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef lint
 
2
static 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>
 
11
PROJ_HEAD(apian, "Apian Globular I") "\n\tMisc Sph, no inv.";
 
12
PROJ_HEAD(ortel, "Ortelius Oval") "\n\tMisc Sph, no inv.";
 
13
PROJ_HEAD(bacon, "Bacon Globular") "\n\tMisc Sph, no inv.";
 
14
FORWARD(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
}
 
30
FREEUP; if (P) pj_dalloc(P); }
 
31
ENTRY0(bacon)
 
32
        P->bacn = 1;
 
33
        P->ortl = 0;
 
34
        P->es = 0.; P->fwd = s_forward;
 
35
ENDENTRY(P)
 
36
ENTRY0(apian)
 
37
        P->bacn = P->ortl = 0;
 
38
        P->es = 0.; P->fwd = s_forward;
 
39
ENDENTRY(P)
 
40
ENTRY0(ortel)
 
41
        P->bacn = 0;
 
42
        P->ortl = 1;
 
43
        P->es = 0.; P->fwd = s_forward;
 
44
ENDENTRY(P)