public override PJ Init() { phi1 = Math.Abs(Proj.pj_param_r(ctx, parameters, "lat_ts")); mode = phi1 > EPS; if (mode) { fxb = 0.5 * Math.Sin(phi1); fxa = 0.5 / fxb; } es = 0.0; fwd = s_forward; return(this); }
public double proj_inv_mdist(projCtx ctx, double dist) { double k = 1.0 / (1.0 - es); int i = MAX_ITER_mdist; double phi = dist; while (i-- > 0) { double s = Math.Sin(phi); double t = 1.0 - es * s * s; phi -= t = (proj_mdist(phi, s, Math.Cos(phi)) - dist) * (t * Math.Sqrt(t)) * k; if (Math.Abs(t) < TOL14) { return(phi); // that is no change } } // convergence failed Proj.pj_ctx_set_errno(ctx, -17); return(phi); }