1
static const char RCS_ID[] = "$Id: PJ_lcca.c,v 1.1 2003/03/04 02:59:41 warmerda Exp $";
2
/* PROJ.4 Cartographic Projection System -- Revision Log:
4
**Revision 1.1 2003/03/04 02:59:41 warmerda
10
#define PROJ_PARMS__ \
17
PROJ_HEAD(lcca, "Lambert Conformal Conic Alternative")
18
"\n\tConic, Sph&Ell\n\tlat_0=";
20
static double /* func to compute dr */
21
fS(double S, double C) {
22
return(S * ( 1. + S * S * C));
24
static double /* deriv of fs */
25
fSp(double S, double C) {
26
return(1. + 3.* S * S * C);
28
FORWARD(e_forward); /* ellipsoid */
31
S = pj_mlfn(lp.phi, sin(lp.phi), cos(lp.phi), P->en) - P->M0;
34
xy.x = P->k0 * (r * sin( lp.lam *= P->l ) );
35
xy.y = P->k0 * (P->r0 - r * cos(lp.lam) );
38
INVERSE(e_inverse); /* ellipsoid & spheroid */
39
double theta, dr, S, dif;
44
theta = atan2(xy.x , P->r0 - xy.y);
45
dr = xy.y - xy.x * tan(0.5 * theta);
46
lp.lam = theta / P->l;
48
for (i = MAX_ITER; i ; --i) {
49
S -= (dif = (fS(S, P->C) - dr) / fSp(S, P->C));
50
if (fabs(dif) < DEL_TOL) break;
53
lp.phi = pj_inv_mlfn(S + P->M0, P->es, P->en);
56
FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } }
58
double s2p0, N0, R0, tan0, tan20;
60
if (!(P->en = pj_enfn(P->es))) E_ERROR_0;
61
if (!pj_param(P->params, "tlat_0").i) E_ERROR(50);
62
if (P->phi0 == 0.) E_ERROR(51);
64
P->M0 = pj_mlfn(P->phi0, P->l, cos(P->phi0), P->en);
66
R0 = 1. / (1. - P->es * s2p0);
72
P->C = 1. / (6. * R0 * N0);