16 lines
503 B
JavaScript
16 lines
503 B
JavaScript
export default function(ml, e0, e1, e2, e3) {
|
|
var phi;
|
|
var dphi;
|
|
|
|
phi = ml / e0;
|
|
for (var i = 0; i < 15; i++) {
|
|
dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
|
|
phi += dphi;
|
|
if (Math.abs(dphi) <= 0.0000000001) {
|
|
return phi;
|
|
}
|
|
}
|
|
|
|
//..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
|
|
return NaN;
|
|
} |