proj4js/lib/common/phi2z.js
2025-04-29 20:22:09 +02:00

18 lines
484 B
JavaScript

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;
}