Statistics
| Revision:

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

History | View | Annotate | Download (573 Bytes)

1
/* determine latitude angle phi-2 */
2
#ifndef lint
3
static const char SCCSID[]="@(#)pj_phi2.c        4.3        93/06/12        GIE        REL";
4
#endif
5
#include <projects.h>
6

    
7
#define HALFPI                1.5707963267948966
8
#define TOL 1.0e-10
9
#define N_ITER 15
10

    
11
        double
12
pj_phi2(double ts, double e) {
13
        double eccnth, Phi, con, dphi;
14
        int i;
15

    
16
        eccnth = .5 * e;
17
        Phi = HALFPI - 2. * atan (ts);
18
        i = N_ITER;
19
        do {
20
                con = e * sin (Phi);
21
                dphi = HALFPI - 2. * atan (ts * pow((1. - con) /
22
                   (1. + con), eccnth)) - Phi;
23
                Phi += dphi;
24
        } while ( fabs(dphi) > TOL && --i);
25
        if (i <= 0)
26
                pj_errno = -18;
27
        return Phi;
28
}