latiso.js 419 B

12345678910111213141516
  1. import {HALF_PI} from '../constants/values';
  2. export default 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. }