Sha256: c8077952ffdf7e3dce7f520c048ea634dd3164cbc60ed4f964d12152f3d9f1f6

Contents?: true

Size: 561 Bytes

Versions: 5

Compression:

Stored size: 561 Bytes

Contents

// Abstract azimuthal projection.
function d3_geo_azimuthal(scale, angle) {
  function azimuthal(λ, φ) {
    var cosλ = Math.cos(λ),
        cosφ = Math.cos(φ),
        k = scale(cosλ * cosφ);
    return [
      k * cosφ * Math.sin(λ),
      k * Math.sin(φ)
    ];
  }

  azimuthal.invert = function(x, y) {
    var ρ = Math.sqrt(x * x + y * y),
        c = angle(ρ),
        sinc = Math.sin(c),
        cosc = Math.cos(c);
    return [
      Math.atan2(x * sinc, ρ * cosc),
      Math.asin(ρ && y * sinc / ρ)
    ];
  };

  return azimuthal;
}

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
mdarray-sol-0.1.0-java node_modules/dc/node_modules/d3/src/geo/azimuthal.js
stripchart-0.0.3 lib/stripchart/public/components/d3/src/geo/azimuthal.js
stripmem-0.0.3 lib/stripmem/public/components/d3/src/geo/azimuthal.js
stripmem-0.0.2 lib/stripmem/public/components/d3/src/geo/azimuthal.js
stripmem-0.0.1 lib/stripmem/public/components/d3/src/geo/azimuthal.js