latiso.js 401 B

12345678910111213141516
  1. var HALF_PI = Math.PI/2;
  2. module.exports = function(eccent, phi, sinphi) {
  3. if (Math.abs(phi) > HALF_PI) {
  4. return Number.NaN;
  5. }
  6. if (phi === HALF_PI) {
  7. return Number.POSITIVE_INFINITY;
  8. }
  9. if (phi === -1 * HALF_PI) {
  10. return Number.NEGATIVE_INFINITY;
  11. }
  12. var con = eccent * sinphi;
  13. return Math.log(Math.tan((HALF_PI + phi) / 2)) + eccent * Math.log((1 - con) / (1 + con)) / 2;
  14. };