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

18 lines
480 B
JavaScript
Raw Permalink Normal View History

2023-10-02 13:04:02 +00:00
import {HALF_PI} from '../constants/values';
export default function(eccent, ts) {
var eccnth = 0.5 * eccent;
var con, dphi;
var phi = HALF_PI - 2 * Math.atan(ts);
for (var i = 0; i <= 15; i++) {
con = eccent * Math.sin(phi);
dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
phi += dphi;
if (Math.abs(dphi) <= 0.0000000001) {
return phi;
}
}
//console.log("phi2z has NoConvergence");
return -9999;
}