tp = Math.tan(lpphi);
lpphi -= (dphi = (xyy * (lpphi * tp + 1.) - lpphi -
.5 * ( lpphi * lpphi + B) * tp) /
((lpphi - xyy) / tp - 1.));
} while (Math.abs(dphi) > CONV && --i > 0);
if (i == 0) throw new ProjectionException("I");
out.x = Math.asin(xyx * Math.tan(lpphi)) / Math.sin(lpphi);
out.y = lpphi;
}
} else {
xyy += ml0;
if (Math.abs(xyy) <= TOL) { out.x = xyx; out.y = 0.; }
else {
double r, c, sp, cp, s2ph, ml, mlb, mlp, dPhi;
int i;
r = xyy * xyy + xyx * xyx;
for (lpphi = xyy, i = I_ITER; i > 0; --i) {
sp = Math.sin(lpphi);
s2ph = sp * ( cp = Math.cos(lpphi));
if (Math.abs(cp) < ITOL)
throw new ProjectionException("I");
c = sp * (mlp = Math.sqrt(1. - es * sp * sp)) / cp;
ml = ProjectionMath.mlfn(lpphi, sp, cp, en);
mlb = ml * ml + r;
mlp = (1.0 / es) / (mlp * mlp * mlp);
lpphi += ( dPhi =
( ml + ml + c * mlb - 2. * xyy * (c * ml + 1.) ) / (
es * s2ph * (mlb - 2. * xyy * ml) / c +
2.* (xyy - ml) * (c * mlp - 1. / s2ph) - mlp - mlp ));
if (Math.abs(dPhi) <= ITOL)
break;
}
if (i == 0)
throw new ProjectionException("I");
c = Math.sin(lpphi);
out.x = Math.asin(xyx * Math.tan(lpphi) * Math.sqrt(1. - es * c * c)) / Math.sin(lpphi);
out.y = lpphi;
}
}