phi2z.js 480 B

1234567891011121314151617
  1. import {HALF_PI} from '../constants/values';
  2. export default function(eccent, ts) {
  3. var eccnth = 0.5 * eccent;
  4. var con, dphi;
  5. var phi = HALF_PI - 2 * Math.atan(ts);
  6. for (var i = 0; i <= 15; i++) {
  7. con = eccent * Math.sin(phi);
  8. dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
  9. phi += dphi;
  10. if (Math.abs(dphi) <= 0.0000000001) {
  11. return phi;
  12. }
  13. }
  14. //console.log("phi2z has NoConvergence");
  15. return -9999;
  16. }