Sha256: 828fcaf0a56459bfbaa6d0f8cd25d32d5d34040f197c5343b92c610b33b8dda4

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 Bytes

Contents

// @import parallel1

function craig(φ0) {
  var tanφ0 = Math.tan(φ0);

  function forward(λ, φ) {
    return [
      λ,
      (λ ? λ / Math.sin(λ) : 1) * (Math.sin(φ) * Math.cos(λ) - tanφ0 * Math.cos(φ))
    ];
  }

  forward.invert = tanφ0 ? function(x, y) {
    if (x) y *= Math.sin(x) / x;
    var cosλ = Math.cos(x);
    return [
      x,
      2 * Math.atan2(Math.sqrt(cosλ * cosλ + tanφ0 * tanφ0 - y * y) - cosλ, tanφ0 - y)
    ];
  } : function(x, y) {
    return [
      x,
      asin(x ? y * Math.tan(x) / x : y)
    ];
  };

  return forward;
}

(d3.geo.craig = function() { return parallel1Projection(craig); }).raw = craig;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
d3js-plugins-rails-0.0.4 vendor/assets/javascripts/d3/plugins/geo/projection/craig.js
d3js-plugins-rails-0.0.3 vendor/assets/javascripts/d3/plugins/geo/projection/craig.js