/Proj4/PJ_rpoly.c
C | 38 lines | 37 code | 1 blank | 0 comment | 5 complexity | c398879e18ed273adab56b90c1d5883a MD5 | raw file
1#ifndef lint 2static const char SCCSID[]="@(#)PJ_rpoly.c 4.1 94/02/15 GIE REL"; 3#endif 4#define PROJ_PARMS__ \ 5 double phi1; \ 6 double fxa; \ 7 double fxb; \ 8 int mode; 9#define EPS 1e-9 10#define PJ_LIB__ 11#include "projects.h" 12PROJ_HEAD(rpoly, "Rectangular Polyconic") 13 "\n\tConic, Sph., no inv.\n\tlat_ts="; 14FORWARD(s_forward); /* spheroid */ 15 double fa; 16 17 if (P->mode) 18 fa = tan(lp.lam * P->fxb) * P->fxa; 19 else 20 fa = 0.5 * lp.lam; 21 if (fabs(lp.phi) < EPS) { 22 xy.x = fa + fa; 23 xy.y = - P->phi0; 24 } else { 25 xy.y = 1. / tan(lp.phi); 26 xy.x = sin(fa = 2. * atan(fa * sin(lp.phi))) * xy.y; 27 xy.y = lp.phi - P->phi0 + (1. - cos(fa)) * xy.y; 28 } 29 return (xy); 30} 31FREEUP; if (P) pj_dalloc(P); } 32ENTRY0(rpoly) 33 if ((P->mode = (P->phi1 = fabs(pj_param(P->params, "rlat_ts").f)) > EPS)) { 34 P->fxb = 0.5 * sin(P->phi1); 35 P->fxa = 0.5 / P->fxb; 36 } 37 P->es = 0.; P->fwd = s_forward; 38ENDENTRY(P)