/Proj4/pj_phi2.c
C | 28 lines | 24 code | 3 blank | 1 comment | 3 complexity | 384399f443a6d51866535412b08c44a5 MD5 | raw file
1/* determine latitude angle phi-2 */ 2#ifndef lint 3static 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 12pj_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}