Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-proj4 / src / PJ_collg.c @ 7098

History | View | Annotate | Download (910 Bytes)

1
#ifndef lint
2
static const char SCCSID[]="@(#)PJ_collg.c        4.1 94/02/15     GIE     REL";
3
#endif
4
#define PJ_LIB__
5
# include        <projects.h>
6
PROJ_HEAD(collg, "Collignon") "\n\tPCyl, Sph.";
7
#define FXC        1.12837916709551257390
8
#define FYC        1.77245385090551602729
9
#define ONEEPS        1.0000001
10
FORWARD(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
}
19
INVERSE(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
}
31
FREEUP; if (P) pj_dalloc(P); }
32
ENTRY0(collg) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P)