tethys-feature-service/node_modules/proj4/lib/common/pj_inv_mlfn.js

23 lines
625 B
JavaScript
Raw Normal View History

2023-10-02 13:04:02 +00:00
import pj_mlfn from "./pj_mlfn";
import {EPSLN} from '../constants/values';
var MAX_ITER = 20;
export default function(arg, es, en) {
var k = 1 / (1 - es);
var phi = arg;
for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
var s = Math.sin(phi);
var t = 1 - es * s * s;
//t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
//phi -= t * (t * Math.sqrt(t)) * k;
t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
phi -= t;
if (Math.abs(t) < EPSLN) {
return phi;
}
}
//..reportError("cass:pj_inv_mlfn: Convergence error");
return phi;
}